The band uses the current M1 open when initialization occurs after the trigger time. A late start does not reconstruct the 06:00 open.
Asian Range: Percentage Breakout
Builds a percentage band around a timed M1 opening price and trades breaks on either side.
How the source is structured
- Once per day, after the trigger time, anchor a band to the current M1 open.
- Buy above the upper band and sell below the lower band, consuming each side's trigger after an attempt.
- At the end time, attempt to close positions matching the chart symbol and configured magic number.
Default inputs
| Anchor time / end time | 06:00 / 22:00 server time |
|---|---|
| Band width on each side | 0.5% of the anchor price |
| Volume | 0.1 lot |
| Stop / target | 0.5% / 0.5% |
| Magic number | 123 |
Source-review notes
These observations come from reading this uploaded version. They are not compiler output or a complete code audit. The download retains the source as supplied.
This is a breakout implementation despite the original 'Drop' filename. It does not measure an actual Asian-session high/low range.
Triggers are cleared without checking order success, and the sell request passes ask as its price.
Dependencies
MetaTrader 5 standard Trade library. The band is calculated directly from M1 prices.
Source & attribution
The original filename includes 'Rene'; the source contains no author or license declaration.
Included in the Edge Quant source collection with existing notices preserved. Free download does not imply a new license grant.
Inspect the original source
The browser preview is decoded for reading; the download keeps the original file bytes.
Expand full MQL5 source · 96 lines
#define OBJ_PREFIX_BOX "Box"#include <Trade/Trade.mqh>input double Lots = 0.1;input double TpPercent = 0.5;input double SlPercent = 0.5;input ulong Magic = 123;input double RangePercent = 0.5;input int TriggerTimeMin = 360;input int EndTimeMin = 1320;input bool IsCloseAtEndTime = true;double rangeHigh;double rangeLow;CTrade trade;int OnInit(){ trade.SetExpertMagicNumber(Magic); return(INIT_SUCCEEDED);}void OnDeinit(const int reason){}void OnTick(){ MqlDateTime dt; TimeCurrent(dt); dt.hour = (int)(TriggerTimeMin / 60); dt.min = (int)(TriggerTimeMin % 60); dt.sec = 0; datetime triggerTime = StructToTime(dt); dt.hour = (int)(EndTimeMin / 60); dt.min = (int)(EndTimeMin % 60); datetime endTime = StructToTime(dt); static int lastDay = 0; if(lastDay != dt.day_of_year){ rangeHigh = 0; rangeLow = 0; datetime time0 = iTime(_Symbol,PERIOD_M1,0); static datetime timestamp; if(timestamp != time0 && TimeCurrent() >= triggerTime){ timestamp = time0; lastDay = dt.day_of_year; double open0 = iOpen(_Symbol,PERIOD_M1,0); rangeHigh = open0 + open0*RangePercent / 100; rangeLow = open0 - open0*RangePercent / 100; string objName = OBJ_PREFIX_BOX + "" + TimeToString(triggerTime); ObjectCreate(0,objName,OBJ_RECTANGLE,0,triggerTime,rangeHigh,endTime,rangeLow); } } if(IsCloseAtEndTime && TimeCurrent() >= endTime){ for(int i = PositionsTotal() - 1; i >= 0; i--){ CPositionInfo pos; if(pos.SelectByIndex(i) && pos.Symbol() == _Symbol && pos.Magic() == Magic){ trade.PositionClose(pos.Ticket()); } } } if(TimeCurrent () < endTime){ double bid = SymbolInfoDouble(_Symbol,SYMBOL_BID); double ask = SymbolInfoDouble(_Symbol,SYMBOL_ASK); if(rangeHigh > 0 && bid > rangeHigh){ double tp = 0; if(TpPercent > 0 ) tp = ask + ask*TpPercent / 100; double sl = ask - ask*SlPercent / 100; trade.Buy(Lots,_Symbol,ask,sl,tp,"Box Trading"); rangeHigh = 0; } if (rangeLow > 0 && bid <rangeLow){ double tp = 0; if(TpPercent > 0) tp = bid - bid * TpPercent / 100; double sl = bid + bid*SlPercent / 100; trade.Sell(Lots,_Symbol,ask,sl,tp,"Box Trading"); rangeLow = 0; } } }Educational source material, not investment advice. No profitability, execution quality or live-readiness claim is made for this upload.