- www.mql5.com
- Migration - Virtual Hosting for 24/7 Operation
- Installation on Mac OS - For Advanced Users - Getting Started
- Deposits and withdrawals - Getting Started
Not sure where to reply if your reply ends in mql4.com.
No interrupts would appear during any event method, but timeout when closing the entire GUI. All history buffers stay unchanged until the event method finishes.
Not sure where to reply if your reply ends in mql4.com.
No interrupts would appear during any event method, but timeout when closing the entire GUI. All history buffers stay unchanged until the event method finishes.
Thank you! Excuse my ignorance, I am new to MQL4 programming... Can you elaborate on the term 'event method'? From the example given below, if you don't mind, can you identify the event methods? Thank you!
//+------------------------------------------------------------------+ //| Ichimoku Kinko Hyo | //+------------------------------------------------------------------+ 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[]) { int i,k,pos; double high_value,low_value; //--- if(rates_total<=InpTenkan || rates_total<=InpKijun || rates_total<=InpSenkou) return(0); //--- counting from 0 to rates_total ArraySetAsSeries(ExtTenkanBuffer,false); ArraySetAsSeries(ExtKijunBuffer,false); ArraySetAsSeries(ExtSpanA_Buffer,false); ArraySetAsSeries(ExtSpanB_Buffer,false); ArraySetAsSeries(ExtChikouBuffer,false); ArraySetAsSeries(ExtSpanA2_Buffer,false); ArraySetAsSeries(ExtSpanB2_Buffer,false); ArraySetAsSeries(open,false); ArraySetAsSeries(high,false); ArraySetAsSeries(low,false); ArraySetAsSeries(close,false); //--- initial zero if(prev_calculated<1) { for(i=0; i<InpTenkan; i++) ExtTenkanBuffer[i]=0.0; for(i=0; i<InpKijun; i++) ExtKijunBuffer[i]=0.0; for(i=0; i<ExtBegin; i++) { ExtSpanA_Buffer[i]=0.0; ExtSpanA2_Buffer[i]=0.0; } for(i=0; i<InpSenkou; i++) { ExtSpanB_Buffer[i]=0.0; ExtSpanB2_Buffer[i]=0.0; } } //--- Tenkan Sen pos=InpTenkan-1; if(prev_calculated>InpTenkan) pos=prev_calculated-1; for(i=pos; i<rates_total; i++) { high_value=high[i]; low_value=low[i]; k=i+1-InpTenkan; while(k<=i) { if(high_value<high[k]) high_value=high[k]; if(low_value>low[k]) low_value=low[k]; k++; } ExtTenkanBuffer[i]=(high_value+low_value)/2; } //--- Kijun Sen pos=InpKijun-1; if(prev_calculated>InpKijun) pos=prev_calculated-1; for(i=pos; i<rates_total; i++) { high_value=high[i]; low_value=low[i]; k=i+1-InpKijun; while(k<=i) { if(high_value<high[k]) high_value=high[k]; if(low_value>low[k]) low_value=low[k]; k++; } ExtKijunBuffer[i]=(high_value+low_value)/2; } //--- Senkou Span A pos=ExtBegin-1; if(prev_calculated>ExtBegin) pos=prev_calculated-1; for(i=pos; i<rates_total; i++) { ExtSpanA_Buffer[i]=(ExtKijunBuffer[i]+ExtTenkanBuffer[i])/2; ExtSpanA2_Buffer[i]=ExtSpanA_Buffer[i]; } //--- Senkou Span B pos=InpSenkou-1; if(prev_calculated>InpSenkou) pos=prev_calculated-1; for(i=pos; i<rates_total; i++) { high_value=high[i]; low_value=low[i]; k=i+1-InpSenkou; while(k<=i) { if(high_value<high[k]) high_value=high[k]; if(low_value>low[k]) low_value=low[k]; k++; } ExtSpanB_Buffer[i]=(high_value+low_value)/2; ExtSpanB2_Buffer[i]=ExtSpanB_Buffer[i]; } //--- Chikou Span pos=0; if(prev_calculated>1) pos=prev_calculated-1; for(i=pos; i<rates_total; i++) ExtChikouBuffer[i]=close[i]; //--- return(rates_total); } //+------------------------------------------------------------------+
Thank you! Excuse my ignorance, I am new to MQL4 programming... Can you elaborate on the term 'event method'? From the example given below, if you don't mind, can you identify the event methods? Thank you!
OnCalculate is an "event method".
- docs.mql4.com
Thank you! That explains it all. There is no interrupt during a pass of OnCalculate, so the process ignores new ticks of data until control is passed on the Return. My question has been answered, so now I can proceed...
Thank you! Excuse my ignorance, I am new to MQL4 programming... Can you elaborate on the term 'event method'? From the example given below, if you don't mind, can you identify the event methods? Thank you!

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use