资源描述:
《五分钟动量交易系统》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、五分钟动量交易系统(EA,不是指标)小弟根据《五分钟动量交易系统》编的,请大家多多指教!//+------------------------------------------------------------------+//
2、五分钟动量交易系统.mq4
3、//+------------------------------------------------------------------+externdoubleMAPeriod=20;//指数均线周期externdoubleStopLossSpred=20;//初始止损
4、离均线的点数externdoubleCloseSpred=15;//后半仓止损离均线的点数externdoubleLots=0.2;//持仓,必须为偶数//+------------------------------------------------------------------+//
5、
6、//+------------------------------------------------------------------+intstart(){doubleMacdCurrent,MacdPrevious,Ma;int
7、cnt,ticket,total;if(Bars0){if(OrderSelect(ticket,SELECT_BY_TICKET,MODE_TRADES))Print("多单减仓成功:",OrderOpenPrice());}elsePrint("多单减仓发生错误:",GetLastError());return(0);}//修改后半仓位的止损价到盈亏平衡点if(Ask-OrderOpenPrice()>OrderOpenPrice()-OrderStopLoss()&&OrderOpenPrice()>OrderStopLos
8、s()&&OrderLots()==Lots/2){ticket=OrderModify(OrderTicket(),OrderOpenPrice(),OrderOpenPrice(),OrderTakeProfit(),0,Red);if(ticket>0){if(OrderSelect(ticket,SELECT_BY_TICKET,MODE_TRADES))Print("多单盈亏平衡点修改成功:",OrderOpenPrice());}elsePrint("多单盈亏平衡点修改发生错误:",GetLastError());re
9、turn(0);}//根据行情发展修改剩余仓位的止损价到均线下15点if(Ma-CloseSpred*Point>OrderStopLoss()&&OrderOpenPrice()0){if(OrderSelect(ticket,SELECT_BY_TICKET,MODE_TRADES))Print("多单止损修改成功:",OrderOpenPrice());}elsePrint("多单止损修改发生错误:",GetLastError());return(0);}}else//如果有做空单存在{//空单减仓检查if(OrderOpe
10、nPrice()-Bid>OrderStopLoss()-OrderOpenPrice()&&OrderOpenPrice()0){if(OrderSelect(ticket,SELECT_BY_TICKET,MODE_TRADES))Print("空单减仓成功:",OrderOpenPrice());}elsePrint("空单减仓发生错误:",GetLastError());return(0);}//修改后半仓位的止损价到盈亏平衡点if(OrderOpenPrice()-Bid>OrderStopLoss()-OrderOpe
11、nPrice()&&OrderOpenPrice()0){if(OrderSelect(ticket,SELECT_BY_TICKET,MODE_TRADES))Print("空单盈亏平衡点修改成功:",OrderOpenPrice());}elsePrint("空单盈亏平衡点修改发生错误:",GetLastError());return(0);}//根据行情发展修改剩余仓位的止损价到均线下15点if(Ma+CloseSpred*Point=OrderStopLoss()&&OrderLots()==Lots/2){ticket=
12、OrderModify(OrderTicket(),OrderOpenPrice(),Ma+CloseSpred*Point,OrderTakeProfit(),0,Green);if(ticket>0){if(OrderSelect(ticket