Download MetaTrader 5

Time[0] using my variable period instead of default chart time

To add comments, please log in or register
Find out how your rating can be improved
simoncs
321
simoncs 2013.12.17 05:12 

Hi,

I think one of the issues with performance for my optimizations is that i calculate one of my indicators - ZIgZag on every tick instead of every new candle.

I am already using the Time[0] for my TP function so I thought I could use this in a similar way for the ZigZag indicator. I already have a variable for the time period of the zigzag indicator = ExtZZSwingTF

static datetime Time0;

   if( Time0 == Time[0] )
      return(0);  

then use

Time0 = Time[0];

but this obviously refers to the candle period of the selected chart - I think?

so how can I say...

only calculate on a new bar based on the variable ExtSwingTF, irrelevant to the chart timeframe?

thanks

Simon

Ubzen
5394
Ubzen 2013.12.17 08:17  
simoncs:

Hi,

I think one of the issues with performance for my optimizations is that i calculate one of my indicators - ZIgZag on every tick instead of every new candle.

I am already using the Time[0] for my TP function so I thought I could use this in a similar way for the ZigZag indicator. I already have a variable for the time period of the zigzag indicator = ExtZZSwingTF

then use

but this obviously refers to the candle period of the selected chart - I think?

so how can I say...

only calculate on a new bar based on the variable ExtSwingTF, irrelevant to the chart timeframe?

thanks

Simon

Use the functions with the i... for example iTime();

https://docs.mql4.com/series/iTime

simoncs
321
simoncs 2013.12.17 09:13  
ubzen:

Use the functions with the i... for example iTime();

https://docs.mql4.com/series/iTime


thanks - that's just what I need!
To add comments, please log in or register