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

 

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

 
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

 
ubzen:

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

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


thanks - that's just what I need!