|
1楼
楼主 |
发表于 2022-9-16 08:40:48
|
只看该作者
Params Numeric FastLength(5); //短周期 Numeric SlowLength(40); //长周期 Numeric TradeUint(5); //每次交易手数 Integer LongPrd(26); Integer ShortPrd(12); Integer M(9); Vars NumericSeries AvgValue1; NumericSeries AvgValue2; BoolSeries bCrossOver(false); BoolSeries bCrossDn(False); Begin //策略执行区 Numeric DIFF = EMA(Close,ShortPrd) - EMA(Close,LongPrd); Numeric DEA = EMA(DIFF,M); Numeric ret = 2*(DIFF-DEA); PlotNumeric("DIFF",DIFF); PlotNumeric("DEA",DEA); if(ret>0) { PlotStickLine("MACD",ret,0,ColorUp()); } Else { PlotStickLine("MACD",ret,0,ColorDown()); } AvgValue1 = AverageFC(CLOSE,FastLength); AvgValue2 = AverageFC(CLOSE,SlowLength); PlotNumeric("MA1",AvgValue1); PlotNumeric("MA2",AvgValue2); bCrossOver = C>AvgValue1&&AvgValue1>AvgValue2&&C>O&&DIFF>0 &&c>H [1]&&macd>macd{1}; |
|