How to access an indicator value from different timeframe?

 

Hi,

I would like to compare 5min Close with 1H indicator value in my strategy. But I am not sure about proper shift.

if (NewBarOpened == true) // In my case it is every 5min

{

double Indicator=iCustom(NULL, 60, "Indicator name",Parameter,0,0); // What number should I use there instead of 0?

With shift = 0 the 1H indicator value is not constant for 60minutes, but changes during this interval. I saw some solutions with time[shift] etc...

Thanks for help

Peter

 
P_Cherry:

Hi,

I would like to compare 5min Close with 1H indicator value in my strategy. But I am not sure about proper shift.

if (NewBarOpened == true) // In my case it is every 5min

{

double Indicator=iCustom(NULL, 60, "Indicator name",Parameter,0,0); // What number should I use there instead of 0?

With shift = 0 the 1H indicator value is not constant for 60minutes, but changes during this interval. I saw some solutions with time[shift] etc...reply

Hi P_Cherry,


That is because you are getting active values on the current bar...which keeps changing until the bar closes.


You can compare your 5min and H1 directly without using shift by changing the TIME FRAME in your iCustom statements...


double Indicator1=iCustom(NULL, 60, "Indicator name",Parameter,0,0);

double Indicator2=iCustom(NULL, 5, "Indicator name",Parameter,0,0);


Once you have both values, you can then compare them any way you want.


Hope this helps,

Robert

 

But I compare latest completed 5min bar close with 1H indicator value like this:

if(5minClose[1] <= 1HindicatorValue[1])


I found the following solution, but I am not sure about Time[1] or Time[0] and +0 or +1...

double Indicator=iCustom(NULL, Timeframe, "Indictor name",Parameter,0,iBarShift(NULL,Timeframe,Time[1],false)+0);

 

can someone help me edit sar ohlc to use heiken ashi ohlc

Hi, I have an MTF indicator that uses sar, however I'd like the sar to calculate heiken ashi ohlc, and not the normal type

Can you tell me how I can do this, my mtf indicator calls to the sar indicator to calculate sar formula, I think it is calling to the internal indicator in mt4 that can not edit

you can skype or email if you can assist and like to talk about it

skype sty671

email sty671@gmail.com

I can also supply the original file that I'm trying to use heiken ashi ohlc for

 

I want to get 15min indicator value at latest closed 1min bar (it means bar[1], so should I use:

double Indicator=iCustom(NULL, Timeframe, "Indictor name",Parameter,0,iBarShift(NULL,Timeframe,Time[0],false)+0);

or

double Indicator=iCustom(NULL, Timeframe, "Indictor name",Parameter,0,iBarShift(NULL,Timeframe,Time[0],false)+1);

or

double Indicator=iCustom(NULL, Timeframe, "Indictor name",Parameter,0,iBarShift(NULL,Timeframe,Time[1],false)+1);

or

double Indicator=iCustom(NULL, Timeframe, "Indictor name",Parameter,0,iBarShift(NULL,Timeframe,Time[1],false)+0);

?

Thanks

Peter

 

T0+0 = 'value for TF bar of current bar'

T0+1 = 'value for TF bar before TF bar of current bar'

T1+1 = 'value for TF bar before TF of bar before current bar'

T1+0 = 'value for TF bar of bar before current bar'

 
brewmanz:

T0+0 = 'value for TF bar of current bar'

T0+1 = 'value for TF bar before TF bar of current bar'

T1+1 = 'value for TF bar before TF of bar before current bar'

T1+0 = 'value for TF bar of bar before current bar'

Uffff:)))

If I understood good, I should use T1+0 = 15min value 1min ago right?

Because T0+1 means 15min value but 15minutes ago?

Thank you

P.

Reason: