Experts: Easy Range Breakout EA - MT5

 

Easy Range Breakout EA - MT5:

This EA implements a range breakout trading strategy. It calculates a price range between start and end times defined by the user, draws a visual rectangle on the chart to mark the high and low of that range, and then monitors price action after the range closes. If the market breaks above the range high, it opens a buy trade; if it breaks below the range low, it opens a sell trade.

Easy Range Breakout EA - MT5

Author: Osmar Sandoval Espinosa

 

Bugs

  1. SYMBOL_TRADE_STOPS_LEVEL used as a constant — it's an enum identifier for SymbolInfoInteger , not a value. You need SymbolInfoInteger(Symbol(), SYMBOL_TRADE_STOPS_LEVEL) .
  2. ChartSetInteger(0, CHART_COLOR_GRID, false) — false is 0 which sets the grid to black (invisible on black background, but not "no grid"). To hide the grid, use CHART_SHOW_GRID : ChartSetInteger(0, CHART_SHOW_GRID, false) .
  3. Range box never updates its time anchors — when the range is still forming, rangeHigh / rangeLow change but the rectangle's time coordinates are only set at creation. The else branch updates prices but not times, so if the object was created with stale price corners the first tick, it stays malformed.
  4. int d = 0; unused variable inside OnTick.
  5. No symbol filter on position close — PositionClose at end-of-day closes ALL positions on the account, not just this EA's/symbol's. Add if(pos.Symbol() == Symbol()) .
  6. No magic number — multiple EAs on the same account will conflict. Use trade.SetExpertMagicNumber() and filter positions by magic.
  7. SL/TP validation is one-sided — for Buy you check ask - rangeLow > stops_level but don't check tp - ask > stops_level . Same gap on the Sell side for TP distance.
  8. minLot initialized at global scope — SymbolInfoDouble may not return valid data before OnInit . Move it inside OnInit .

Improvements

  • Add an input for magic number and lot size.
  • Filter positions by magic + symbol on close.
  • Add spread filter — if spread is wider than X% of range, skip the trade.
  • The range is recalculated every tick even after it's finalized (after RangeTimeEnd ). Cache it once.
  • Typo: TrandingEndTime → TradingEndTime .
 
Ivan Privalov #:

Bugs

  1. SYMBOL_TRADE_STOPS_LEVEL used as a constant — it's an enum identifier for SymbolInfoInteger , not a value. You need SymbolInfoInteger(Symbol(), SYMBOL_TRADE_STOPS_LEVEL) .
  2. ChartSetInteger(0, CHART_COLOR_GRID, false) — false is 0 which sets the grid to black (invisible on black background, but not "no grid"). To hide the grid, use CHART_SHOW_GRID : ChartSetInteger(0, CHART_SHOW_GRID, false) .
  3. Range box never updates its time anchors — when the range is still forming, rangeHigh / rangeLow change but the rectangle's time coordinates are only set at creation. The else branch updates prices but not times, so if the object was created with stale price corners the first tick, it stays malformed.
  4. int d = 0; unused variable inside OnTick.
  5. No symbol filter on position close — PositionClose at end-of-day closes ALL positions on the account, not just this EA's/symbol's. Add if(pos.Symbol() == Symbol()) .
  6. No magic number — multiple EAs on the same account will conflict. Use trade.SetExpertMagicNumber() and filter positions by magic.
  7. SL/TP validation is one-sided — for Buy you check ask - rangeLow > stops_level but don't check tp - ask > stops_level . Same gap on the Sell side for TP distance.
  8. minLot initialized at global scope — SymbolInfoDouble may not return valid data before OnInit . Move it inside OnInit .

Improvements

  • Add an input for magic number and lot size.
  • Filter positions by magic + symbol on close.
  • Add spread filter — if spread is wider than X% of range, skip the trade.
  • The range is recalculated every tick even after it's finalized (after RangeTimeEnd ). Cache it once.
  • Typo: TrandingEndTime → TradingEndTime .
Thanks for the feedback, I'll add them ASAP.
 
Sow how to play metatrader 5 using demo 

 
0799849873 #:
Sow how to play metatrader 5 using demo 

Metaquotes provides a free Beta MT5 platform, free demo accounts, and free demo price feeds:
Download the MetaTrader 5 trading platform for free
Download the MetaTrader 5 trading platform for free
  • www.metatrader5.com
MetaTrader 5 offers a wide variety of functions for the modern forex and exchange market trader: Full set of trading orders for flexible Forex, Stocks and other securities trading Two position accounting systems: netting and hedging Unlimited amount of charts with 21 timeframes and one-minute history of quotes; Technical analysis with over 80...
 
Is it possible to adapt it to XAUUSD obviously changing the operating hours and arranging the filters ?
 
Tonybarba # : Apakah mungkin untuk mengadaptasinya ke XAUUSD dengan mengubah jam operasional dan mengatur filternya?
im finished combine another strategy with this base breakout ea