自定义数组求周期最大值【源码】
[*]//+------------------------------------------------------------------+
[*]//| 3均线.mq4 |
[*]//| Copyright ?2007, 520FX Corp. |
[*]//| http://www.520fx.com |
[*]//+------------------------------------------------------------------+
[*]#property copyright \"Copyright ?2007, 520FX Corp.\"
[*]#property link \"http://www.520fx.com\"
[*]
[*]#property indicator_separate_window
[*]#property indicator_buffers 4
[*]#property indicator_color1 Yellow
[*]#property indicator_color2 Green
[*]#property indicator_color3 Red
[*]#property indicator_color4 Red
[*]
[*]extern int MaPeriod=5;
[*]extern int 最高值周期=13;
[*]double Ma1[],Ma2[],MaDiff[],MaDiffHigh[];
[*]//+------------------------------------------------------------------+
[*]//| Custom indicator initialization function |
[*]//+------------------------------------------------------------------+
[*]int init()
[*]{
[*]IndicatorBuffers(4);
[*]SetIndexStyle(0,DRAW_LINE);
[*]SetIndexStyle(1,DRAW_NONE);
[*]SetIndexStyle(2,DRAW_NONE);
[*]SetIndexStyle(3,DRAW_NONE);
[*]SetIndexBuffer(0,MaDiffHigh);
[*]SetIndexBuffer(1,Ma1);
[*]SetIndexBuffer(2,Ma2);
[*]SetIndexBuffer(3,MaDiff);
[*]return(0);
[*]}
[*]
[*]int start()
[*]{
[*]int i;
[*]int limit;
[*]int counted_bars=IndicatorCounted();
[*]if(counted_bars0) counted_bars--;
[*]limit=Bars-counted_bars;
[*]for (i=limit-1;i>=0;i--)
[*]{
[*]Ma1=iMA(NULL,0,MaPeriod,0,MODE_EMA,PRICE_HIGH,i);
[*]Ma2=iMA(NULL,0,MaPeriod,0,MODE_EMA,PRICE_LOW,i);
[*]MaDiff=Ma1-Ma2;
[*]}
[*]for (i=limit-1;i>=0;i--)
[*]{
[*]MaDiffHigh=MaDiff;
[*]}
[*]return(0);
[*]}
[*]//------------------------------------------------------------
复制代码 这个贴不错!!!!! 鉴定完毕.! 好帖,有才 小生对楼主之仰慕如滔滔江水连绵不绝,海枯石烂,天崩地裂,永不变心. 我的啦嘿嘿 我帮你 喝喝 现在越做月亏啊 嘿嘿......哈哈......呵呵.....哟~呼 我在顶贴~!~
页:
[1]
2