放到int init的前面,也就是全局变量的设置里,如下面所示..
[C] 纯文本查看 复制代码#property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1 Green
#property indicator_color2 Red
//----
double TrendUp[];
double TrendDown[];
double NonTrend[];
int st=0;
int UpDownShift;
==================
将变量设置放在这里就OK了.
==================
//----
extern int TrendCCI_Period=14;
extern bool Automatic_Timeframe_setting;
extern int M1_CCI_Period=14;
extern int M5_CCI_Period=14;
extern int M15_CCI_Period=14;
extern int M30_CCI_Period=14;
extern int H1_CCI_Period=14;
extern int H4_CCI_Period=14;
extern int D1_CCI_Period=14;
extern int W1_CCI_Period=14;
extern int MN_CCI_Period=14;
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- indicators
SetIndexStyle(0,DRAW_LINE,0,2);