1、1MACD 指标交易系统交易规则:DIF 在零轴之上,并大于 DEA 时买进;DIF 零轴之上向下突破 DEA 时,平仓离场;MACD 参数使用(4,20,20),已优化;交易头寸默认 1 手/ 简称: MACDJYXT/ 名称: MACD 交易系统/ 类别: 公式应用/ 类型: 用户应用/-ParamsNumeric FastLength(4);Numeric SlowLength(20);Numeric MACDLength(20);Numeric Lots(1);VarsNumericSeries MACDValue;NumericSeries AvgMACD;Numeric MACDD
2、iff;BeginMACDValue = XAverage( Close, FastLength ) - XAverage( Close, SlowLength ) ;AvgMACD = XAverage(MACDValue,MACDLength);MACDDiff = MACDValue - AvgMACD;PlotNumeric(“MACD“,MACDValue);PlotNumeric(“MACDAvg“,AvgMACD);If (MACDDiff = 0)PlotNumeric(“MACDDiff“,MACDDiff,0,Red);ElsePlotNumeric(“MACDDiff“,MACDDiff,0,Green);PlotNumeric(“零线“,0);If(MarketPosition = 0 and MACDValue1 AvgMACD1 and MACDValue1 0)Buy(Lots,Open);If(MarketPosition = 1 and Date LastEntryDate and MACDValue1 AvgMACD1)Sell(0,Open);End