ATR Grid Trader Pro
- Experts
- Vladimir Shumikhin
- Version: 1.0
- Activations: 10
ATR Grid Trader Pro
Description
ATR Grid Trader Pro is a multifunctional Expert Advisor (EA) for the MetaTrader 5 platform that combines grid trading technology with volatility analysis based on the Average True Range (ATR) indicator. It opens buy trades during low volatility and sell trades during high volatility, and when grid trading mode (UseGrid) is enabled, it places additional orders at a specified step (GridStep). This approach helps to effectively leverage market fluctuations and adapt to various trading conditions, whether it's Forex, gold, oil (Brent/WTI), or cryptocurrencies (Bitcoin, Ethereum, etc.).
Key Features and Advantages
1. Volatility-Based Trading (ATR)
- The EA calculates the ATR on a given timeframe and compares the value with two threshold levels (ATR_HighThreshold and ATR_LowThreshold).
- If the volatility is below the lower threshold, ATR Grid Trader Pro considers opening buy trades.
- If the volatility is above the upper threshold, the EA considers opening sell trades.
2. Grid Trading
- When the UseGrid option is enabled, the EA adds additional orders at a certain step (GridStep) once the specified price distance (MinGridDistance) is reached.
- The ability to limit the total number of grid orders (MaxGridOrders) helps manage risks during strong market movements.
3. Risk Management
- You can use a fixed lot (Lot_Size) or calculate the lot size as a percentage of your balance (UseRiskPercent).
- StopLoss / TakeProfit are specified in points and can be disabled (by setting them to 0).
- TrailingStop / BreakEven help protect profits and minimize losses by moving stop-loss levels as the trade becomes profitable.
4. Control of Trading Direction (Trading Direction)
- This allows you to choose to trade only long (DIRECTION_BUY), only short (DIRECTION_SELL), or both directions (DIRECTION_BOTH).
- This is useful if you rely on external market analysis or trade in a trending environment.
5. Daily Limits
- The DailyLimit function restricts the number of trades per day (MaxOrdersPerDay), which protects the trader from excessive activity during periods of low efficiency.
6. Flexible Settings
- The ability to set your own MagicNumber and trade comments (TradeComment) helps you easily identify the EA’s orders among others.
- A wide range of settings (timeframe, spread, grid steps, ATR periods, etc.) provides the trader with full control over the strategy.
Detailed Description of Parameters
-
ATR Indicator Settings
- ATR_Period (default 14): The period used to calculate the ATR. The higher the period, the more smoothed the volatility reading.
- ATR_HighThreshold (default 0.0015): The upper volatility threshold. If the normalized ATR value exceeds this level, the EA considers opening sell trades.
- ATR_LowThreshold (default 0.0007): The lower volatility threshold. If the normalized ATR value is below this level, the EA considers opening buy trades.
- TimeFrame (default PERIOD_H1): The timeframe on which the EA calculates the ATR. The higher the timeframe, the fewer signals.
-
Trading Direction (Trading Direction)
- TradeDirection (DIRECTION_BOTH / DIRECTION_BUY / DIRECTION_SELL):
- DIRECTION_BOTH: Opens both buy and sell trades (based on signals).
- DIRECTION_BUY: Opens only buy trades.
- DIRECTION_SELL: Opens only sell trades.
- TradeDirection (DIRECTION_BOTH / DIRECTION_BUY / DIRECTION_SELL):
-
Stop Loss & Take Profit Settings
- StopLoss (default 1000): Stop-loss in points. Set to “0” to disable stop-loss.
- TakeProfit (default 885): Take-profit in points. Set to “0” to disable take-profit.
-
Trailing Stop & BreakEven Settings
- TrailingStop (true/false): Enables or disables the trailing stop feature.
- TrailingStart (350): The amount of profit (in points) after which the trailing stop starts working.
- TrailingDistance (72): The distance in points between the current price and the stop-loss when the trailing stop is active.
- TrailingStep (99): The minimum increment by which the price must move further for the EA to shift the stop-loss again.
- BreakEven (true/false): Enables or disables the break-even function.
- BreakEvenStart (118): The profit level (in points) at which the EA sets the stop-loss to break even.
- BreakEvenOffset (41): The number of points by which the stop-loss is moved above (for buys) or below (for sells) the opening price.
-
Trading Rules
- MaxSpread (12): The maximum allowed spread (in points). If the actual spread exceeds this value, the EA will not open a trade.
- MagicNumber (777): A unique identifier for the EA’s trades.
- TradeComment ("ATR Grid"): A comment attached to trades.
- Lot_Size (0.01): The fixed lot size if the EA is not using risk-based lot sizing (UseRiskPercent).
-
Grid Trading Settings
- UseGrid (true/false): Enables or disables the grid trading feature.
- GridStep (155): The grid step in points. After a trade is opened, if the price moves by GridStep points, the EA may open an additional order (if other conditions are met).
- MinGridDistance (174): The minimum distance between the prices of opened orders in the grid, preventing overly frequent entries.
- MaxGridOrders (3): The maximum number of orders in the grid for one direction (Buy/Sell).
- MinutesBetweenTrades (36): The amount of time (in minutes) that must pass between trades. Helps avoid entering the market too frequently.
- DailyLimit (true/false): Enables or disables the daily trade limit.
- MaxOrdersPerDay (3): The maximum number of trades the EA can open in one day.
-
Risk Management
- UseRiskPercent (true/false): Allows the EA to calculate lot size based on a specified risk percentage. If “false,” the EA uses a fixed lot (Lot_Size).
- RiskPercent (1.0): The percentage of the account balance used for lot size calculation. When opening a trade, the EA considers the stop-loss to determine the allowable risk.
How the EA Works
-
Volatility Analysis (ATR)
- On every new candle (or tick), the EA gets the current ATR value on the selected timeframe and compares it to the upper and lower thresholds (ATR_HighThreshold, ATR_LowThreshold).
- If it is below the lower threshold and the buy direction is enabled, the EA considers opening a buy order.
- If it is above the upper threshold and the sell direction is enabled, the EA considers opening a sell order.
-
Grid Trading Mode
- If UseGrid = true, then after opening the first trade, the EA can open additional orders each time the price reaches the next step (GridStep), but only if all conditions are met (minimum distance, order limit, etc.).
- This creates a series of trades (a grid) that can increase overall profit in a trending or highly volatile market.
-
Stop Loss & Take Profit
- The EA sets the stop-loss and take-profit according to the specified points.
- If StopLoss or TakeProfit = 0, the corresponding parameter is not set.
-
Trailing Stop & BreakEven
- When TrailingStop is enabled, the EA moves the stop-loss level as profits grow.
- When BreakEven is enabled, the stop-loss is moved to the breakeven level (and slightly beyond) after reaching a certain profit threshold.
-
Trade Management and Risk Control
- The EA checks MaxSpread before opening a trade.
- If UseRiskPercent = true, it automatically calculates the lot size based on the allowed risk percentage and planned stop-loss.
- Additional margin protection: if there are insufficient funds, the EA may reduce the lot by half.
-
Daily Limits and Time Filter
- DailyLimit limits the number of trades per day to prevent overtrading.
- MinutesBetweenTrades prevents the EA from opening trades more often than a specified interval.
Recommended Instruments for Trading
- Popular Forex pairs: EUR/USD, GBP/USD, USD/JPY, USD/CHF, AUD/USD, NZD/USD, USD/CAD
- Commodities and Metals: Gold (XAU/USD), Silver (XAG/USD), WTI Oil, Brent Oil
- Cryptocurrencies: Bitcoin (BTC/USD), Ethereum (ETH/USD), Litecoin (LTC/USD)
Advantages of Using This EA
-
Flexible Configuration and Adaptability
- The EA’s architecture allows you to fine-tune the trading strategy for a specific market instrument and trading conditions. You can precisely adjust parameters ranging from timeframe and ATR thresholds to grid steps.
-
Intelligent Capital Management
- Built-in protective mechanisms (TrailingStop, BreakEven, UseRiskPercent) help preserve your deposit and maximize profits under various market conditions. Calculating lot size as a percentage of the account balance automatically adapts trade sizes to your current balance.
-
Optimized Trading Frequency
- Functions like MinutesBetweenTrades and DailyLimit prevent excessive trading activity and help avoid market entries during unfavorable periods, which is crucial for preserving capital when market conditions change.
-
Effective Use of Grid Strategy
- Grid mode creates extra opportunities to profit during trending or volatile movements. At the same time, a system that limits the number of orders safeguards against excessive risk during sharp moves against your position.
-
Volatility-Based Trading
- Using ATR allows the EA to determine the best moments to enter the market based on objective data about current volatility rather than subjective assessments. High and low volatility are used for making different trading decisions.
ATR Grid Trader Pro combines the classic volatility analysis indicator (ATR) with a well-thought-out grid trading system and comprehensive risk management tools. This approach creates a versatile and safer automated trading tool suitable for various markets and financial instruments.
Important: Always test the EA on a demo account or in the strategy tester, and keep in mind the risks associated with automated trading.