Breakout Indicator For MT5
Table Of Contents:
- Breakout Indicator For MT5
- Installation des Breakout Indicator For MT5
- Parameter des Breakout Indicator For MT5
- Puffer des Breakout Indicator For MT5
- Hauptteile des Codes
Der Breakout Indicator For MT5 ist ein Indikator, der hohe und niedrige Werte auf dem Chart Breakout Indicator For MT5 und zur Erkennung von Breakouts verwendet werden kann. Sie können die Start- und Endzeit der Zone definieren, aus der der Indikator das Hoch und Tief berechnet. Der Indikator zeichnet dann 2 durchgezogene und 2 gepunktete Linien auf der Karte für jede Zone, die den konfigurierten Zeiten entspricht. Aufgrund der Konfigurationsparameter, die Stunden und Minuten enthalten, wird dieser Indikator hauptsächlich für den Intraday-Handel verwendet.
Installation des Breakout Indicator For MT5
Nachdem Sie den Indikator über das obige Formular heruntergeladen haben, müssen Sie die Zip-Datei entpacken. Anschließend müssen Sie die Datei Breakout.mq5 in den Ordner MQL5Indicators Ihrer MT5 Installation kopieren. Starten Sie danach MT5 neu und Sie können den Indikator in der Liste der Indikatoren sehen.
Parameter des Breakout Indicator For MT5
Der Breakout Indicator For MT5 verfügt über 6 zu konfigurierende Parameter.
input uint InpHourBegin = 0; // "Period" Hour begin input uint InpMinBegin = 0; // "Period" Minutes begin input uint InpHourEnd = 5; // "Period" Hour end input uint InpMinEnd = 0; // "Period" Minutes end input uint InpHourEndArea = 23; // "Area" Hour end input uint InpMinEndArea = 0; // "Area" Minutes end
Puffer des Breakout Indicator For MT5
Der Breakout Indicator For MT5 stellt 4 Puffer bereit.
SetIndexBuffer(0,BufferUpperPeriod,INDICATOR_DATA); SetIndexBuffer(1,BufferLowerPeriod,INDICATOR_DATA); SetIndexBuffer(2,BufferUpperArea,INDICATOR_DATA); SetIndexBuffer(3,BufferLowerArea,INDICATOR_DATA);
Hauptteile des Codes
int OnCalculate(const int rates_total, const int prev_calculated, const datetime &time[], const double &open[], const double &high[], const double &low[], const double &close[], const long &tick_volume[], const long &volume[], const int &spread[]) { //--- @ gt 25@:0 =0 lt 8=8 lt 0;L= gt 5 : gt ;85AB2 gt 10@ gt 2 4;O @0AGQB0 if(rates_total lt 4) return 0; //--- #AB0= gt 2:0 lt 0AA82 gt 2 1CD5@ gt 2 :0: B09 lt A5@89 ArraySetAsSeries(high,true); ArraySetAsSeries(low,true); ArraySetAsSeries(time,true); //--- @ gt 25@:0 8 @0AGQB : gt ;8G5AB20 ?@ gt AG8BK205 lt KE 10@ gt 2 int limit=rates_total-prev_calculated; if(limit gt 1) { limit=rates_total-1; ArrayInitialize(BufferUpperPeriod,EMPTY_VALUE); ArrayInitialize(BufferLowerPeriod,EMPTY_VALUE); ArrayInitialize(BufferUpperArea,EMPTY_VALUE); ArrayInitialize(BufferLowerArea,EMPTY_VALUE); } //--- gt 43 gt B gt 2:0 40==KE int begin_bar,end_bar; double min_price,max_price; //--- 0AGQB 8=48:0B gt @0 for(int i=limit; i gt =0 && !IsStopped(); i--) { int cur_min=TimeHour(time[i])*60+TimeMinute(time[i]); if((period_end_min gt period_begin_min && cur_min gt =period_begin_min && cur_min lt =period_end_min) || (period_end_min lt period_begin_min && (cur_min gt =period_begin_min || cur_min lt =period_end_min))) { begin_bar=FindBar(InpHourBegin,InpMinBegin,time[i]); if(begin_bar==WRONG_VALUE) continue; int hb=Highest(begin_bar-i+1,i); int lb=Lowest(begin_bar-i+1,i); if(hb==WRONG_VALUE || lb==WRONG_VALUE) continue; max_price=high[hb]; min_price=low[lb]; for(int j=begin_bar; j gt =i; j--) { BufferUpperPeriod[j]=max_price; BufferLowerPeriod[j]=min_price; } } else { BufferUpperPeriod[i]=EMPTY_VALUE; BufferLowerPeriod[i]=EMPTY_VALUE; } if((box_end_mn gt period_end_min && cur_min gt =period_end_min && cur_min lt =box_end_mn) || (box_end_mn lt period_end_min && (cur_min gt =period_end_min || cur_min lt =box_end_mn))) { begin_bar=FindBar(InpHourBegin,InpMinBegin,time[i]); end_bar=FindBar(InpHourEnd,InpMinEnd,time[i]); if(begin_bar==WRONG_VALUE || end_bar==WRONG_VALUE) continue; int hb=Highest(begin_bar-end_bar+1,end_bar); int lb=Lowest(begin_bar-end_bar+1,end_bar); if(hb==WRONG_VALUE || lb==WRONG_VALUE) continue; max_price=high[hb]; min_price=low[lb]; for(int j=end_bar; j gt =i; j--) { BufferUpperArea[j]=max_price; BufferLowerArea[j]=min_price; } } else { BufferUpperArea[i]=EMPTY_VALUE; BufferLowerArea[i]=EMPTY_VALUE; } } //--- return value of prev_calculated for next call return(rates_total); } //+------------------------------------------------------------------+ //| gt 72@0I05B G0A C:070== gt 3 gt 2@5 lt 5=8 | //+------------------------------------------------------------------+ int TimeHour(const datetime time) { MqlDateTime tm; TimeToStruct(time,tm); return tm.hour; } //+------------------------------------------------------------------+ //| gt 72@0I05B lt 8=CBC C:070== gt 3 gt 2@5 lt 5=8 | //+------------------------------------------------------------------+ int TimeMinute(const datetime time) { MqlDateTime tm; TimeToStruct(time,tm); return tm.min; } //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ int FindBar(int hour,int minutes,datetime time) { MqlDateTime tm; TimeToStruct(time,tm); tm.hour=hour; tm.min=minutes; datetime t=StructToTime(tm); if(t gt time) t-=86400; return BarShift(Symbol(),PERIOD_CURRENT,t); } //+------------------------------------------------------------------+ //| gt 72@0I05B A lt 5I5=85 10@0 ? gt 2@5 lt 5=8 | //| https://www.mql5.com/ru/code/1864 | //+------------------------------------------------------------------+ int BarShift(const string symbol_name,const ENUM_TIMEFRAMES timeframe,const datetime time,bool exact=false) { datetime last_bar; if(!SeriesInfoInteger(symbol_name,timeframe,SERIES_LASTBAR_DATE,last_bar)) { datetime array[1]; if(CopyTime(symbol_name,timeframe,0,1,array)==1) last_bar=array[0]; else return WRONG_VALUE; } if(time gt last_bar) return(0); int shift=Bars(symbol_name,timeframe,time,last_bar); datetime array[1]; if(CopyTime(symbol_name,timeframe,time,1,array)==1) return(array[0]==time ? shift-1 : exact && time gt array[0]+PeriodSeconds(timeframe) ? WRONG_VALUE : shift); return WRONG_VALUE; } //+------------------------------------------------------------------+ //| gt 72@0I05B 8=45:A lt 0:A8 lt 0;L= gt 3 gt 7=0G5=8O B09 lt A5@88 High | //+------------------------------------------------------------------+ int Highest(const int count,const int start) { double array[]; ArraySetAsSeries(array,true); if(CopyHigh(Symbol(),PERIOD_CURRENT,start,count,array)==count) return ArrayMaximum(array)+start; return WRONG_VALUE; } //+------------------------------------------------------------------+ //| gt 72@0I05B 8=45:A lt 8=8 lt 0;L= gt 3 gt 7=0G5=8O B09 lt A5@88 Low | //+------------------------------------------------------------------+ int Lowest(const int count,const int start) { double array[]; ArraySetAsSeries(array,true); if(CopyLow(Symbol(),PERIOD_CURRENT,start,count,array)==count) return ArrayMinimum(array)+start; return WRONG_VALUE; } //+------------------------------------------------------------------+