查看:1166回复:0
[MT5相关]哪里出问题了?
刚刚开始学,想画一条线出来,但运行的时候没有线,哪位大神帮忙看看?
#property indicator_chart_window
#property indicator_buffers 1
#property indicator_color1 Red
#property indicator_width1 2
double buf;
input int period=10;
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int OnInit()
{ SetIndexBuffer(0,buf);
SetIndexStyle(0,DRAW_LINE);
SetIndexDrawBegin(0,period);
//--- 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)
{
int limit=Bars-IndicatorCounted();
for(int i=0; i