iteration problem

 
I have an issue related to getting the difference between 2 devs over different timeframes during looping on the current chart bars,

When the current bar of the current currect changed it affected on the previous bar not the current bar of the histogram

I know that happened the because the different of the time frames shifting but can't handle that issue,

there is any support to solve that issue
 
  1. You must use proper English to be understood.

    “current bar of the current currect” is nonsense.

  2. Initially Indicator counted is zero so your loop start at Bars and arrays exceeded.

  3. You should stop using the old event handlers (init, start, deinit) and IndicatorCounted() and start using new event handlers (OnInit, OnTick/OnCalculate, OnDeinit).
              Event Handling Functions - MQL4 Reference
              How to do your lookbacks correctly - MQL4 programming forum #9-14 & #19 (2016)

  4.         MTFFieldPrice=iClose(NULL,MTF,i); 

    On MT4: Unless the current chart is that specific symbol(s)/TF(s) referenced, you must handle 4066/4073 errors before accessing candle/indicator values.
              Download history in MQL4 EA - MQL4 programming forum - Page 3 #26.4 (2019)

  5.    int Dev1counted_bars = IndicatorCounted();

    You have IC in the main loop. Don't call it in any other function. It is for the current chart only. It does not apply to any other timeframe. Convert your chart bar index to other timeframe index.

 
Ahmed Elsayed:

Do not double post!!!

I have deleted your duplicated post.