EA18-5点移动止损

include
include
extern double TakeProfit=20;
extern double Lots=1;
extern double TrailingStop=5;
int start()
{
int cnt, ticket, total;
total = OrdersTotal();
//----
if(total < 1)
{
if(MessageBox("TO SELL 1.00 LOT OF "+Symbol()+" PRESS YES, TO BUY PRESS NO",
"Script",MB_YESNO|MB_ICONQUESTION)!=IDYES)
{
ticket=OrderSend(Symbol(),OP_BUY,Lots,Ask,3,0,Ask+TakeProfitPoint,"My EA",12345,0,Green); } else { ticket=OrderSend(Symbol(),OP_SELL,Lots,Bid,3,0,Bid-TakeProfitPoint,"My EA",12345,0,Red);
}
return(0);
}
//================================================================
//===============================
for(cnt=0;cnt0)
{
if(Bid-OrderOpenPrice()>PointTrailingStop) { if(OrderStopLoss()TrailingStop)
{
OrderModify(OrderTicket(),OrderOpenPrice(),Bid-PointTrailingStop,OrderTakeProfit(),0,Green); } return(0); } } } } else { if(TrailingStop>0) { if((OrderOpenPrice()-Ask)>(PointTrailingStop))
{
if((OrderStopLoss()>(Ask+PointTrailingStop)) ||(OrderStopLoss()==0)) { OrderModify(OrderTicket(),OrderOpenPrice(),Ask+PointTrailingStop,
OrderTakeProfit(),0,Red);
}
return(0);
}
}
}
}
return(0);
}