//自定义函数,这里只是直接使用库函数实现MA, 若你自己计算,可设计任何指标
void ma()
{
int pos=Bars;
//Bars = Number of bars in the current chart.当前窗口中的蜡烛数
while(pos>=0)
{
Buffer0[pos]=iMA(NULL,0,MA_Period,MA_Shift,MA_Method,MA_Price,pos);
pos--;
}
}
//+--------------------------------------------------
例2
//+--------------------------------------------------
#property indicator_separate_window
#property indicator_buffers 7
#property indicator_color1 Red
#property indicator_color2 Yellow
#property indicator_color3 Blue
#property indicator_color4 Green
#property indicator_color5 Gray
#property indicator_color6 SkyBlue
#property indicator_color7 Tan
extern int MA_Period=13;
extern int MA_Shift=0;
extern int MA_Method=2;
extern int MA_Price = 6;