IndicatorCounted() function in different timeframe

 

Hello ,

I would like to ask if it is possible to count the new bars of a different Timeframe using IndicatorCounted() or another function .. for example, if I am on M15 and want the result of the counted bars on the Timeframe of H1 how to use IndicatorCounted to get this result ? 

 
ochan chin: I would like to ask if it is possible to count the new bars of a different Timeframe using IndicatorCounted() or another function .. for example, if I am on M15 and want the result of the counted bars on the Timeframe of H1 how to use IndicatorCounted to get this result ? 
Please don't use IndicatorCounted() function. It is the very old almost obsolete style of coding an Indicator in MT4. Use the more modern MQL4+ style with the OnCalculate() event handling function which is more compatiable with MQL5.
 
Fernando Carreiro #:
Please don't use IndicatorCounted() function. It is the very old almost obsolete style of coding an Indicator in MT4. Use the more modern MQL4+ style with the OnCalculate() event handling function which is more compatiable with MQL5.

OK thanks for the help, I will go see and try to adapt my program with those, maybe the problem will be solved )) 

 
  1. 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)

  2. You know which bar is new. Use iBarShift to find the new H1 bar index.

    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 - Forex Calendar - MQL4 programming forum - Page 3 #26.4 (2019)

 
William Roeder #:
  1. 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)

  2. You know which bar is new. Use iBarShift to find the new H1 bar index.

    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 - Forex Calendar - MQL4 programming forum - Page 3 #26.4 (2019)

Thanks William your response helped me ))
Reason: