//------------------------------------------------------------------------ // 简称:MACD15M // 名称:MACD15M // 类别: 交易指令 // 类型: 用户应用 //------------------------------------------------------------------------ Params //参数定义 Integer LongPrd(26); Integer ShortPrd(12); Integer M(9); GlobalVars //全局变量定义 Vars //局部变量定义 Begin //策略执行区 String filepath("D:\\11.txt");//文件路径 NumericArray m15 = HisData(Enum_Data_Close, Enum_Period_Day, 1); Numeric iDEA; Numeric iDIFF; iMACD(m15, iDIFF, iDEA, ShortPrd, LongPrd, m); Numeric ret = 2*(iDIFF-iDEA); PlotNumeric("DIFF",iDIFF); PlotNumeric("DEA",iDEA); FileAppend("D:\\11.txt","当前k线的日期、时间、对应日线的DIFF、DEA值分别为:"+Text(CurrentDate)+"--"+Text(CurrentTime)+"=="+Text(iDIFF)+"=="+Text(iDEA));//写入数据,方便对照 if(ret>0) { PlotStickLine("MACD",ret,0,ColorUp()); } Else { PlotStickLine("MACD",ret,0,ColorDown()); } End |