下载MetaTrader 5
要添加评论,请登录注册
您知道MQL5的事件处理吗?
顏宏
5
顏宏 2013.08.25 18:46 

QQ小弟我沒寫過程式,於是照本宣科參考網路寫法

滿心期盼第一支自己打上去的指標可以生成,開心地按下F5結果出現

'int' - comma or semicolon expected

'init' - expression on global scope not allowed

'SMA' - variable not defined

'Buf3' - variable not defined <----這東西總共有九筆= =|||

'}' - unbalanced parentheses


各位><大哥這是哪裡出了問題~~~~小弟不才............

#property copyright "Copyright 2013, MetaQuotes Software Corp."

#property link "http://www.metaquotes.net"

#property indicator_chart_window

#property indicator_buffers 1

#property indicator_color1 Red

#property indicator_width1 1

#property indicator_color2 Green

#property indicator_width2 2

#property indicator_color3 Navy

#property indicator_width3 3

#property indicator_color4 Gray

#property indicator_width4 4

#property indicator_color5 Yellow

#property indicator_width5 5

#property indicator_color6 Aqua

#property indicator_width6 6

#property indicator_color7 Tan

#property indicator_width7 7

#property indicator_color8 Pink

#property indicator_width8 8

#property indicator_color9 DeepPink

#property indicator_width9 9

#property indicator_color10 Black

#property indicator_width10 10



double buf[10];

extern int SMA=10


//+------------------------------------------------------------------+

//| expert initialization function |

//+------------------------------------------------------------------+

int init()

{

int darw_begin;

SetIndexStyle(0,DRAW_LINE);

SetIndexBuffer(0,buf);

SetIndexStyle(1,DRAW_LINE);

SetIndexBuffer(1,Buf2);

SetIndexStyle(2,DRAW_LINE);

SetIndexBuffer(2,Buf3);

SetIndexStyle(3,DRAW_LINE);

SetIndexBuffer(3,Buf4);

SetIndexStyle(4,DRAW_LINE);

SetIndexBuffer(4,Buf5);

SetIndexStyle(5,DRAW_LINE);

SetIndexBuffer(5,Buf6);

SetIndexStyle(6,DRAW_LINE);

SetIndexBuffer(6,Buf7);

SetIndexStyle(7,DRAW_LINE);

SetIndexBuffer(7,Buf8);

SetIndexStyle(8,DRAW_LINE);

SetIndexBuffer(8,Buf9);

SetIndexStyle(9,DRAW_LINE);

SetIndexBuffer(9,Buf10);

}

return(0);

}

//----


//----


//+------------------------------------------------------------------+

//| expert deinitialization function |

//+------------------------------------------------------------------+

int deinit()

{

//----

//----

return(0);

}

//+------------------------------------------------------------------+

//| expert start function |

//+------------------------------------------------------------------+

int start()

{

int limit=Bars-IndicatorCounted();

for(int i=0;i<limit,i++)

{

buf[i]=iMA(NULL,0,SMA,0,2,0,i);

}

//----

//----

return(0);

}

//+------------------------------------------------------------------+

BaiChun Li
838
BaiChun Li 2013.08.30 17:16  
int函数上面的这句

extern int SMA=10少了一个;结尾的符号

当然代码中可能还有其他问题,但是其他问题不是导致'int' - comma or semicolon expected提示的问题。

/
要添加评论,请登录注册