Call OnInit() when a new candle is on the chart

To add comments, please log in or register

Hey everybody,

my indicator draws lines on the chart and on every new day I want the re-initialize the indicator again.

In the OnCalculate() function I will put the following:

OnCalculate(const int rates_total,      // size of input time series
                 const int prev_calculated,  // bars handled in previous call
                 const datetime& time[],     // Time
                 const double& open[],       // Open
                 const double& high[],       // High
                 const double& low[],        // Low
                 const double& close[],      // Close
                 const long& tick_volume[],  // Tick Volume
                 const long& volume[],       // Real Volume
                 const int &spread[]) // Spread)
static datetime candletime;



unfortunately this is not working. What is wrong with this?

Thanks for help!

To add comments, please log in or register