High[], Low[] or Close[] for another timeframe?!

Back to topics list To post a new topic, please log in or register
avatar
315
sunshineh 2010.09.17 20:54
 

Hello,

I have an Indicator, which use the Functions High, Low and Close.

Now I want to change it. I want to add the parameter "Timeframe", so that I can put the indicator on the H1 chart and see the indicator for the M30 oder D1 Timeframe.

Is this possible? How can I do it?!

 
avatar
159
hasayama 2010.09.17 21:05 #
 

Instead of using High[i], Close[i] etc, you need to use iHigh(...), iClose(...). These functions can return values for any TF.

Here is the book;) -> https://docs.mql4.com/series/iClose

 
avatar
315
sunshineh 2010.09.17 21:10 #
 

Lot's of thanks!!! That was a great help!

avatar
12985
avatar
126
Demos 2015.11.09 15:14 #
 
sunshineh:

Hello,

I have an Indicator, which use the Functions High, Low and Close.

Now I want to change it. I want to add the parameter "Timeframe", so that I can put the indicator on the H1 chart and see the indicator for the M30 oder D1 Timeframe.

Is this possible? How can I do it?!

hasayama:

Instead of using High[i], Close[i] etc, you need to use iHigh(...), iClose(...). These functions can return values for any TF.

Here is the book;) -> https://docs.mql4.com/series/iClose

Hello,

you can use iHigh, iClose but you should also have in mind that there are some intricacies.  For example, when you are e.g. in a 1 hour TF, calling a 30 min iHigh(), history for that TF may not be available immediately (you may see https://forum.mql4.com/69967 ). What you can possibly do is to first call all TFs in OnInit() (using, for example, iHigh() ) and Sleep() for some seconds, as to allow for history to get downloaded. Then, you may check the return values of some functions to be sure about

best regards 

avatar
735
honest_knave 2015.11.09 15:31 #
 
Welcome to 2010 everyone 
avatar
126
Demos 2015.11.09 15:49 #
 
oops :) but really, how? is this a by-product of the "similar" button that appeared beneath poster's messages?
avatar
735
honest_knave 2015.11.09 15:55 #
 

No, I think a poster went on a resurrection rampage, posting solutions to very old threads. I think the intentions were good but it did bring a lot of old threads back up to the top.

Either a mod or the poster have deleted their content, but I guess a few got replied to before then. 

Back to topics list  

To add comments, please log in or register