为什么不能实现移动止损 新评论 q4226674 2010.04.13 12:48 问一下这个 EA为什么不能实现移动止损 选择启用警报 然后在赢利3点之后就直接跳出修改止损的对话框 而不是自己修改移动止损 该如何改正? extern double TakeProfit = 100; extern double TrailingStop = 3; int start() { int cnt, ticket, total; total=OrdersTotal(); //if(total<1) // { // return(0); // } for(cnt=0;cnt<total;cnt++) { OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES); if(OrderType()<=OP_SELL && OrderSymbol()==Symbol()) { if(OrderType()==OP_BUY) { if(TrailingStop>0) { if(Bid-OrderOpenPrice()>Point*TrailingStop) { if(OrderStopLoss()<Bid-Point*TrailingStop) { OrderModify(OrderTicket(),OrderOpenPrice(),Bid-Point*TrailingStop,OrderTakeProfit(),0,Green); //return(0); } } } } else { if(TrailingStop>0) { if((OrderOpenPrice()-Ask)>(Point*TrailingStop)) { if((OrderStopLoss()>(Ask+Point*TrailingStop)) || (OrderStopLoss()==0)) { OrderModify(OrderTicket(),OrderOpenPrice(),Ask+Point*TrailingStop,OrderTakeProfit(),0,Red); //return(0); } } } } } } //return(0); } 如何编码? 退出策略。阶梯式止损与拖曳式止损 OrderModify issues 新评论
问一下这个 EA为什么不能实现移动止损
选择启用警报 然后在赢利3点之后就直接跳出修改止损的对话框 而不是自己修改移动止损
该如何改正?
extern double TakeProfit = 100;
extern double TrailingStop = 3;
int start()
{
int cnt, ticket, total;
total=OrdersTotal();
//if(total<1)
// {
// return(0);
// }
for(cnt=0;cnt<total;cnt++)
{
OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES);
if(OrderType()<=OP_SELL && OrderSymbol()==Symbol())
{
if(OrderType()==OP_BUY)
{
if(TrailingStop>0)
{
if(Bid-OrderOpenPrice()>Point*TrailingStop)
{
if(OrderStopLoss()<Bid-Point*TrailingStop)
{
OrderModify(OrderTicket(),OrderOpenPrice(),Bid-Point*TrailingStop,OrderTakeProfit(),0,Green);
//return(0);
}
}
}
}
else
{
if(TrailingStop>0)
{
if((OrderOpenPrice()-Ask)>(Point*TrailingStop))
{
if((OrderStopLoss()>(Ask+Point*TrailingStop)) || (OrderStopLoss()==0))
{
OrderModify(OrderTicket(),OrderOpenPrice(),Ask+Point*TrailingStop,OrderTakeProfit(),0,Red);
//return(0);
}
}
}
}
}
}
//return(0);
}