Overview
The Darvas Box Long/Short EA is a robust, automated trading robot built for MetaTrader 4 (MT4), inspired by Nicolas Darvas' legendary breakout strategy from the 1950s. It scans for momentum-driven breakouts (long) and breakdowns (short) using dynamic "boxes" formed from recent price highs and lows, enhanced with an ATR-based buffer for volatility filtering. This EA is fully universal—compatible with any currency pair (e.g., EURUSD, GBPUSD, XAUUSD) and any timeframe (M1 to Daily)—with no hardcoded restrictions. Simply attach it to a chart, and it adapts automatically.
With built-in risk management, position limits, and visual charting, it's ideal for traders seeking a hands-free, trend-following system that balances opportunity with capital protection. It executes trades 24/7, focusing on high-probability setups while logging results to CSV for easy analysis.
Key Advantages and Features
Universal Adaptability: Seamlessly works across all symbols and timeframes without modifications—perfect for diversified portfolios or scalping to swing trading.
Long and Short Trades: Captures upside momentum with buys on upper box breakouts and downside with sells on lower breakdowns, enabling balanced exposure in any market direction.
ATR-Enhanced Entries: Adds a flexible buffer (ATR value × multiplier) to box edges, filtering out noise and adjusting to volatility for more reliable signals.
1:2 Risk-Reward Ratio: Automatically sets take-profit at twice the stop-loss distance, promoting positive expectancy where winners can outweigh losers.
Smart Risk Management: Dynamically calculates lot sizes to risk only a user-defined percentage of account balance per trade, protecting against large drawdowns.
Position Control: Enforces a strict one-position limit (long or short) to prevent over-trading and compounded risk.
Visual Feedback: Draws the active Darvas Box on your chart in real-time for transparent monitoring of trade zones.
CSV Trade Logging: Exports detailed trade history (ticket, type, lots, times, profit) to a CSV file upon EA removal, for post-analysis in tools like Excel.
Efficient and Reliable: Low CPU usage, no martingale or grid risks—pure breakout logic with predefined rules for consistent performance.
Input Parameters
InpDarvasLookback (int): Number of bars to analyze for forming the Darvas Box (high/low range). Default: 50. Higher values suit longer-term trends; lower for shorter setups.
InpDarvasFlexATR (double): Multiplier applied to ATR for the breakout/breakdown buffer zone. Default: 0.25. Increase for stricter entries in volatile markets.
InpATRPeriod (int): Number of bars for ATR volatility calculation. Default: 14. Standard value for reliable market noise measurement.
InpRiskPercent (double): Percentage of account balance risked per trade (based on stop-loss distance). Default: 1.0. Keep low (0.5-2%) for conservative trading.
InpMagicNumber (ulong): Unique identifier for the EA's trades, allowing multiple instances without interference. Default: 778899.
Installation and Usage Instructions
Download the .mq4 source code and open it in MT4 MetaEditor (Tools > MetaQuotes Language Editor).
Compile (press F7) to generate the .ex4 file.
In MT4, attach the EA to your desired chart: Right-click > Expert Advisors > Attach > Select the EA > OK.
Customize parameters in the inputs window (e.g., adjust risk or lookback). Enable AutoTrading (Ctrl+E) and ensure your broker allows EAs.
For testing: Use MT4 Strategy Tester (Ctrl+R) on historical data. Start with demo accounts to verify performance.
Monitoring: The EA draws boxes on the chart; check the Experts tab for logs. Remove the EA to generate the CSV trade report (in MQL4\Files folder).
Important Notes
Testing Recommendation: Always backtest on your broker's data and forward-test on demo before live use. Optimize parameters like lookback for specific pairs.
Risk Disclaimer: Trading involves risk of loss. This EA does not guarantee profits—use it as part of a broader strategy. Past performance is no indication of future results.
Broker Compatibility: Ensure your broker supports hedging (long/short) and has sufficient history data for the lookback period.
Elevate your trading with the timeless Darvas strategy, now automated and optimized for modern markets. Download and start capturing breakouts today!
If for any reason you do not like the purchased program, you can request a refund within 30 days from the date of purchase. You can also make an exchange for any other product at an equal cost or by paying the difference.
Simply send a request for refund or exchange with your order number by email: support@fx-market.pro.
Refund requests received more than 30 days after purchase will be rejected.