i do not know from where you copied this code but correct version of OnCalculate function is
int OnCalculate(const int rates_total, const int prev_calculated, const datetime &time[], const double &open[], const double &high[], const double &low[], const double &close[], const long &tick_volume[], const long &volume[], const int &spread[]) { //--- return value of prev_calculated for next call return(rates_total); }so you may study about this and fix your code
Rajesh Kumar Nait #: i do not know from where you copied this code but correct version of OnCalculate function
That is only one of two possible function calls. OnCalculate - Event Handling - MQL5 Reference - Reference on algorithmic/automated trading language for MetaTrader 5
OP's call is neither.
William Roeder #:
yes That is only one of two possible function calls. OnCalculate - Event Handling - MQL5 Reference - Reference on algorithmic/automated trading language for MetaTrader 5
OP's call is neither.
joshatt:
const datetime &time[], (in OnCalculate defination)
this is invalid remove it and follow correct function calls
const datetime &time[], (in OnCalculate defination)

You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
As shown in the code, I only added 3 things:
const datetime &time[], (in OnCalculate defination)
void OnDeinit(...)....
ObjectCreate(....)
I don't know, it must have been " const datetime &time[], " that caused the error?
BTW, I do not understand the original source code - what does "price[]" mean? where does it come from?