Access Higher timeframe indicator data window in lower time.

 

Dear Friends,
I want to capture data of higher time frame on lower time frame data.

E.g

1st indicator = RSI for 15 minutes, values are 18, 22, 25, 35, 45, 49, 55, 68 . . . . .for 1 to 8 candles

2nd indicator = RSI for 60 minutes, values are 10, 35 for first four and next four candles.

I want to make an indicator capturing 15 Min RSI for candle 1, 2, 3, 4, 5, 6, 7, 8 . . .  and place the value (which is done).

and one more indicator to capture and hold the 60 min RSI value for candles as 10, 10, 10, 10, 35, 35, 35, 35.

I used

iCustom(NULL,60,"RSI",0,i)    //  60 is my time period and i is my candle index 1, 2 . . . of 15 minutes

Its giving me 60 min candle indicator value on 1st candle of 15 minutes and so on but my requirement is as above.  

Thanks n Regards!

 
Abhijeet n:

Dear Friends,
I want to capture data of higher time frame on lower time frame data.

E.g

1st indicator = RSI for 15 minutes, values are 18, 22, 25, 35, 45, 49, 55, 68 . . . . .for 1 to 8 candles

2nd indicator = RSI for 60 minutes, values are 10, 35 for first four and next four candles.

I want to make an indicator capturing 15 Min RSI for candle 1, 2, 3, 4, 5, 6, 7, 8 . . .  and place the value (which is done).

and one more indicator to capture and hold the 60 min RSI value for candles as 10, 10, 10, 10, 35, 35, 35, 35.

I used

iCustom(NULL,60,"RSI",0,i)    //  60 is my time period and i is my candle index 1, 2 . . . of 15 minutes

Its giving me 60 min candle indicator value on 1st candle of 15 minutes and so on but my requirement is as above.  

Thanks n Regards!

Hi, this would be just a hint from my MT4 experience.  Since the 5th parameter from the function to calculate RSI (i.e. iRSI) is the historical candle (in MT4 it counts backwards being 0=now, 1=60 minutes ago, 2=120 minutes ago, etc) then whatever value you uses in the 15m timeframe, needs to be 1/4 of the value used for 60m.

i.e. If the statement in MT4 to obtain RSI in the 15m timeframe was ....

double RSI15m = iRSI(Symbol(), PERIOD_M15, 14, PRICE_CLOSE, candle15m);

... then an option for the additional 60 minutes RSI would be ....

      int candle60m = (candle15m - (candle15m % 4)) / 4;

      double RSI60m = iRSI(Symbol(), PERIOD_H1, 14, PRICE_CLOSE, candle60m);

Above holds candle60m = 0 for candle15m = 0, 1, 2, 3, then candle60m = 1 for candle15m = 4, 5, 6, 7.

If you prefer holding candle60m = 1 for candle15m = 1, 2, 3, 4, then candle60m = 2 for candle15m = 5, 6, 7, 8 then you may adjust candle60m as follows ...

      int candle60m = (candle15m - ((candle15m-1) % 4)) / 4 + 1;

Hope that helped.
 

Thanks Friend for concern,

I used exactly the same logic for capturing the data but its working for few candles (exactly for 20 candles) and then its giving me wrong results.

its showing previous candle's data as current candle's.

i used following for calculation of candle number of 60 minutes:


int b =MathAbs(i/4);                 where i is the candle number of 15 minutes.

RSI60[i]=iCustom(NULL,60,"RSI",0,b);                  and calculated RSI of 60 minutes based on the MathAbs function; also used iRSI but result does not differ.


Is there any other way to directly capture 60 minutes data either based on time of the 15 min candle given in "if' condition.

i.e. capturing time of 15 minutes and returning the data of 60 minutes only after matching time with 15 minutes?

Can we directly access data indicator value of another indicator for the particular candle? (I used iCustom, but not succeeded)

Thanks n Regards! 

 
int candle60m = (candle15m - (candle15m % 4)) / 4; 
This assumes that all M4 candles exist, not M60. Use iBarShift