Call OnInit() when a new candle is on the chart New comment Dan 2018.05.23 10:21 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; if(iTime(NULL,PERIOD_D1,0)!=candletime) { OnInit(); candletime=iTime(NULL,PERIOD_D1,0); } return(rates_total); } unfortunately this is not working. What is wrong with this? Thanks for help! Questions from Beginners MQL5 MT5 MetaTrader 5 Help in This Indicator What is wrong with this EA? New comment
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:
unfortunately this is not working. What is wrong with this?
Thanks for help!