Little help on iTime / iBarShift ...

 

Hi

I  am using ATR indicator with period as Day. Index[0] of this indicator returns the current day's ATR and as the day progresses it increases or stays same. I want to capture its changes on every 5 minute.

I have tried using iTime/iBarShift functions as below to get Index values on Period_M5. In iBarShift (exact=false or true) gives same results:

    int CurrIdx = iBarShift(m_Symbol,PERIOD_D1,iTime(m_Symbol,m_TF_M5,0));
    int PrevIdx = iBarShift(m_Symbol,PERIOD_D1,iTime(m_Symbol,m_TF_M5,1));

Now when I pass these Index values in ATR_D1 call, it gives me same values for Day[0] M5[2] and M5[1].

HH      0       17:11:51.874    AKT_AlgoTrader v1.01 (US30,M5)  2021.01.28 00:01:00   ATR D1[0] 409.0 PrevM5[2] 591.6 CurrM5[1] 591.6
KG      0       17:11:52.456    AKT_AlgoTrader v1.01 (US30,M5)  2021.01.28 00:05:00   ATR D1[0] 418.4 PrevM5[2] 591.6 CurrM5[1] 418.4
LF      0       17:11:52.903    AKT_AlgoTrader v1.01 (US30,M5)  2021.01.28 00:10:00   ATR D1[0] 420.5 PrevM5[2] 420.5 CurrM5[1] 420.5
FE      0       17:11:53.370    AKT_AlgoTrader v1.01 (US30,M5)  2021.01.28 00:15:00   ATR D1[0] 420.5 PrevM5[2] 420.5 CurrM5[1] 420.5
DD      0       17:11:53.734    AKT_AlgoTrader v1.01 (US30,M5)  2021.01.28 00:20:00   ATR D1[0] 420.5 PrevM5[2] 420.5 CurrM5[1] 420.5
RS      0       17:11:54.344    AKT_AlgoTrader v1.01 (US30,M5)  2021.01.28 00:25:00   ATR D1[0] 429.3 PrevM5[2] 429.3 CurrM5[1] 429.3
OR      0       17:11:55.151    AKT_AlgoTrader v1.01 (US30,M5)  2021.01.28 00:30:00   ATR D1[0] 429.3 PrevM5[2] 429.3 CurrM5[1] 429.3
QQ      0       17:11:55.543    AKT_AlgoTrader v1.01 (US30,M5)  2021.01.28 00:35:00   ATR D1[0] 429.3 PrevM5[2] 429.3 CurrM5[1] 429.3
CP      0       17:11:55.835    AKT_AlgoTrader v1.01 (US30,M5)  2021.01.28 00:40:00   ATR D1[0] 429.3 PrevM5[2] 429.3 CurrM5[1] 429.3
LO      0       17:11:56.615    AKT_AlgoTrader v1.01 (US30,M5)  2021.01.28 00:45:00   ATR D1[0] 430.8 PrevM5[2] 430.8 CurrM5[1] 430.8
KN      0       17:11:57.204    AKT_AlgoTrader v1.01 (US30,M5)  2021.01.28 00:50:00   ATR D1[0] 430.8 PrevM5[2] 430.8 CurrM5[1] 430.8
KM      0       17:11:57.715    AKT_AlgoTrader v1.01 (US30,M5)  2021.01.28 00:55:00   ATR D1[0] 430.8 PrevM5[2] 430.8 CurrM5[1] 430.8
LL      0       17:11:58.419    AKT_AlgoTrader v1.01 (US30,M5)  2021.01.28 01:00:00   ATR D1[0] 430.8 PrevM5[2] 430.8 CurrM5[1] 430.8
RK      0       17:12:02.617    AKT_AlgoTrader v1.01 (US30,M5)  2021.01.28 01:05:00   ATR D1[0] 433.8 PrevM5[2] 433.8 CurrM5[1] 433.8
CJ      0       17:12:08.032    AKT_AlgoTrader v1.01 (US30,M5)  2021.01.28 01:10:00   ATR D1[0] 459.4 PrevM5[2] 459.4 CurrM5[1] 459.4
PI      0       17:12:11.458    AKT_AlgoTrader v1.01 (US30,M5)  2021.01.28 01:15:00   ATR D1[0] 461.7 PrevM5[2] 461.7 CurrM5[1] 461.7    Want these changing values to capture at every 5 minute
EH      0       17:12:21.387    AKT_AlgoTrader v1.01 (US30,M5)  2021.01.28 01:20:00   ATR D1[0] 482.5 PrevM5[2] 482.5 CurrM5[1] 482.5    --do--

Please suggest what I am doing wrong.

Wishing you all a happy weekend.

 

Anil Varma -: Please suggest what I am doing wrong.

Do you really expect an answer? There are no mind readers here and our crystal balls are cracked. Always post all relevant code (using Code button) or attach the file.
     How To Ask Questions The Smart Way. (2004)
          Be precise and informative about your problem

We can't see your broken code.

 
William Roeder #:

Do you really expect an answer? There are no mind readers here and our crystal balls are cracked. Always post all relevant code (using Code button) or attach the file.
     How To Ask Questions The Smart Way. (2004)
          Be precise and informative about your problem

We can't see your broken code.

Thanks William

Got your point. Will post the detailed one tomorrow, as exhausted for the day. Time for going to bed soon.

 

Hi Varma


Please change code


 int CurrIdx = iBarShift(m_Symbol,PERIOD_CURRENT,iTime(m_Symbol,m_TF_M5,0));
    int PrevIdx = iBarShift(m_Symbol,PERIOD_CURRENT,iTime(m_Symbol,m_TF_M5,1));