I am learning MQL4. On their reference website, creating a custom indicator is done like as follows:
#property indicator_chart_window
int init(){
return(0);
}
int deinit(){
ObjectsDeleteAll();
return(0);
}
int start(){
return(0);
}
But when I create a new Indicator from inside the MetaEditor, I get another syntax, like this:
int OnInit()
{
//--- indicator buffers mapping
//---
return(INIT_SUCCEEDED);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
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);
}
Why is it different?
Is there a web link, or book someone can refer me to? From what I read the best place is the MQL4 website, but it looks different and I am not sure where to turn to now.
Any help will be appreciated. Thanks in advance.