Actuelement les marchés sont fermés.
Y-a-t-il une différence entre Bars et rates_total ?
Y-a-t-il une différence entre IndicatorCounted() et prev_calculated ?
Code : Tout sélectionner
//+------------------------------------------------------------------+
//| Difference.mq4 |
//| Copyright 2012, CompanyName |
//| http://www.companyname.net |
//+------------------------------------------------------------------+
#property indicator_chart_window
#property indicator_buffers 1
//---- plot Line
#property indicator_label1 "Line"
#property indicator_type1 DRAW_LINE
#property indicator_color1 clrDarkBlue
#property indicator_style1 STYLE_SOLID
#property indicator_width1 1
//--- indicator buffers
double LineBuffer[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int OnInit()
{
//--- indicator buffers mapping
SetIndexBuffer(0,LineBuffer,INDICATOR_DATA);
//---
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[])
{
//----
Print("*********************************************************");
Print("**************** IndicatorCounted() ********************");
Print("*********************************************************");
Print("Symbol() :",Symbol()," Period() :",Period());
Print("time[0] = ",TimeToString(time[0],TIME_DATE)," time[rates_total-1] = ",TimeToString(time[rates_total-1],TIME_DATE));
Print("Bars :",Bars," rates_total :",rates_total);
Print("IndicatorCounted():",IndicatorCounted()," prev_calculated:",prev_calculated);
//--- return value of prev_calculated for next call
return(rates_total);
}
//+------------------------------------------------------------------+