MQL5: [2] Indicador de Médias Móveis
07/06/2017
1Código Criado
for(int i=0; i<rates_total; i++)
{
ABuffer[i]=(high[i]+low[i])/2;
}
2Código Fonte Completo
#property indicator_chart_window
#property indicator_buffers 1
#property indicator_plots 1
#property indicator_label1 "A"
#property indicator_type1 DRAW_LINE
#property indicator_color1 clrRed
#property indicator_style1 STYLE_SOLID
#property indicator_width1 1
double ABuffer[];
int OnInit()
{
SetIndexBuffer(0,ABuffer,INDICATOR_DATA);
return(INIT_SUCCEEDED);
}
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[])
{
for(int i=0; i<rates_total; i++)
{
ABuffer[i]=(high[i]+low[i])/2;
}
return(rates_total);
}
//+------------------------------------------------------------------+