您需要 登录 才可以下载或查看,没有帐号?注册
1. 在任意一个k线窗口运行,对所有挂单和持仓单有效
2. 如果发现未设置止损,则添加止损。
3.如果浮盈超过一定点数,自动平保。
4. 手动调整止损后本ea不再起作用
参数: 1. 平保点数
2. 止损点数
3. 止盈点数
//+------------------------------------------------------------------+
//| MoveEven.mq4 |
//| Copyright ?2011, metaQuotes Software Corp. |
//+------------------------------------------------------------------+
#property copyright Copyright ?2011, metaQuotes Software Corp.
extern int PointWin = 50;
extern int TakeProfit = 200;
extern int StopLoss = 35;
int PointScale = 10; //在5位小数点报价平台为10,在4位小数点报价平台为1
//+------------------------------------------------------------------+
//| expert initialization function |
//+------------------------------------------------------------------+
int init()
{
//----
//----
return(0);
}
//+------------------------------------------------------------------+
//| expert deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//----
//----
return(0);
}
//+------------------------------------------------------------------+
//| expert start function |
//+------------------------------------------------------------------+
int start()
{
//----
//调整止损
if(OrdersTotal() 0)
{
ChangeStopLoss();
}
//----
return(0);
}
void ChangeStopLoss ()
{
int i;
for(i = OrdersTotal()-1; i i--)
{
OrderSelect(i,SELECT_BY_POS,MODE_TRADES);
int tick = OrderTicket();
double point = MarketInfo(OrderSymbol(), MODE_POINT);
if((OrderType()==OP_BUY )|| (OrderType()==OP_BUYLIMIT))
{
if(OrderStopLoss()== 0)
{
if(OrderModify(tick, OrderOpenPrice(), (OrderOpenPrice()- StopLoss*PointScale*point), (OrderOpenPrice()+ TakeProfit*PointScale*point ),0, Red))
{
Print( ++++++++++Currency pair: , Symbol(), Add StopLoss to ticket: , tick, successfully!!!
Sleep(5000);
}
}
else if( (Bid (OrderOpenPrice()+PointWin*PointScale*point)) (OrderStopLoss() OrderOpenPrice()) (OrderType()==OP_BUY ) )
{
if(OrderModify(tick, OrderOpenPrice(), OrderOpenPrice(), OrderTakeProfit(),0, Red))
{
Print( *********Currency pair: , OrderSymbol(), MoveEvento ticket: , tick, successfully!!!
Sleep(5000);
}
}
} else
if((OrderType() == OP_SELL) || (OrderType() == OP_SELLLIMIT))
{
if(OrderStopLoss()== 0)
{
if(OrderModify(tick, OrderOpenPrice(), (OrderOpenPrice()+ StopLoss*PointScale*point), (OrderOpenPrice()- TakeProfit*PointScale*point ),0, Red))
{
Print( ++++++++++Currency pair: , OrderSymbol(), Add StopLoss to ticket: , tick, successfully!!!
Sleep(5000);
}
}
else if( (Ask (OrderOpenPrice()-PointWin*PointScale*point )) (OrderStopLoss() OrderOpenPrice()) (OrderType() == OP_SELL))
{
if(OrderModify(tick, OrderOpenPrice(), OrderOpenPrice(), OrderTakeProfit(),0, Red))
{
Print( *********Currency pair: , OrderSymbol(), MoveEvento ticket: , tick, successfully!!!
Sleep(5000);
}
}
}
}
}
//+------------------------------------------------------------------+复制代码
外汇交易有很大的风险性,本站所有资源均来自网络,请选择使用,如若出现亏损,本站不承担任何责任!