11月7日MT4编程授课实例代码
[*]//+------------------------------------------------------------------+
[*]//| 指标举例.mq4 |
[*]//| Copyright ?2007, 520FX Corp. |
[*]//| http://www.520fx.com |
[*]//+------------------------------------------------------------------+
[*]#property copyright \"Copyright ?2007, 520FX Corp.\"
[*]#property link \"http://www.520fx.com\"
[*]
[*]#property indicator_chart_window
[*]#property indicator_buffers 2
[*]#property indicator_color1 White
[*]#property indicator_color2 Yellow
[*]
[*]extern int Ma=12;
[*]extern int Ma1=36;
[*]
[*]double MaLine[],Ma1Line[];
[*]//+------------------------------------------------------------------+
[*]//| Custom indicator initialization function |
[*]//+------------------------------------------------------------------+
[*]int init()
[*]{
[*]//---- indicators
[*]IndicatorBuffers(2);
[*]SetIndexStyle(0,DRAW_LINE);
[*]SetIndexStyle(1,DRAW_LINE);
[*]SetIndexBuffer(0,MaLine);
[*]SetIndexBuffer(1,Ma1Line);
[*]//----
[*]return(0);
[*]}
[*]//+------------------------------------------------------------------+
[*]//| Custom indicator deinitialization function |
[*]//+------------------------------------------------------------------+
[*]int deinit()
[*]{
[*]//----
[*]
[*]//----
[*]return(0);
[*]}
[*]//+------------------------------------------------------------------+
[*]//| Custom indicator iteration function |
[*]//+------------------------------------------------------------------+
[*]int start()
[*]{
[*]int limit;
[*]int counted_bars=IndicatorCounted();
[*]if(counted_bars0) counted_bars--;
[*]limit=Bars-counted_bars;
[*]for (int i=limit-1;i>=0;i--)
[*]{
[*]MaLine=iMA(NULL,0,Ma,0,MODE_SMA,PRICE_CLOSE,i);
[*]Ma1Line=iMA(NULL,0,Ma1,0,MODE_SMA,PRICE_CLOSE,i);
[*]}
[*]//----
[*]return(0);
[*]}//+------------------------------------------------------------------+
复制代码 晕不信啊 又看了一次 鉴定完毕.! 小生对楼主之仰慕如滔滔江水连绵不绝,海枯石烂,天崩地裂,永不变心. 我的啦嘿嘿 我帮你 喝喝 现在越做月亏啊 我在顶贴~!~ nice!!!!!!!!!!!!