Page 1 of 1

Candle refresh in Multitimeframe mode

Posted: Wed Aug 16, 2017 7:12 am
by ritutibi
Hi everyone!

Maybe someone can give me an advice for an issue.

How is possible to refresh the candles in the indicator OnInit function on any timeframe, ( multitimeframe mode) so when the first OnCalculate function runs, all the Candle data from the given timeframe will be available?
( the F2 download are not a solution because this should be an automatic function )

if anyone have an idea or a solution, that will be appreciated..

Re: Candle refresh in Multitimeframe mode

Posted: Wed Aug 16, 2017 7:48 am
by mladen
ritutibi wrote: Wed Aug 16, 2017 7:12 am Hi everyone!

Maybe someone can give me an advice for an issue.

How is possible to refresh the candles in the indicator OnInit function on any timeframe, ( multitimeframe mode) so when the first OnCalculate function runs, all the Candle data from the given timeframe will be available?
( the F2 download are not a solution because this should be an automatic function )

if anyone have an idea or a solution, that will be appreciated..
You can not wait for that from init
Instead you do the following :

- "ask" the target time frame how many bars should be calculated
- use the answer at the chart time frame to refresh / recalculate all the bars of the target time frame that need to be recalculated
- and so on ... on each tick

that is the only reliable way to avoid repainting or calculating errors
You can see that method in all the multi time frame versions of indicators that are posted at this forum

Re: Candle refresh in Multitimeframe mode

Posted: Wed Aug 16, 2017 8:53 am
by ritutibi
Thank you so much for the information.
We are very lucky to have you Mr.Mladen.
You are the best!

Happy trading !