After extern parameters, add :
After start(){, add :Code:extern int BreakEven=0;//|-----------------------break even
At the end of the code, add :Code:if(BreakEven>0)MoveBreakEven();
Code:void MoveBreakEven() { int cnt,total=OrdersTotal(); for(cnt=0;cnt<total;cnt++) { OrderSelect(cnt,SELECT_BY_POS,MODE_TRADES); if(OrderType()<=OP_SELL&&OrderSymbol()==Symbol()&&OrderMagicNumber()==Magic) { if(OrderType()==OP_BUY) { if(BreakEven>0) { if(NormalizeDouble((Bid-OrderOpenPrice()),Digits)>BreakEven*Point) { if(NormalizeDouble((OrderStopLoss()-OrderOpenPrice()),Digits)<0) { OrderModify(OrderTicket(),OrderOpenPrice(),NormalizeDouble(OrderOpenPrice()+0*Point,Digits),OrderTakeProfit(),0,Blue); return(0); } } } } else { if(BreakEven>0) { if(NormalizeDouble((OrderOpenPrice()-Ask),Digits)>BreakEven*Point) { if(NormalizeDouble((OrderOpenPrice()-OrderStopLoss()),Digits)<0) { OrderModify(OrderTicket(),OrderOpenPrice(),NormalizeDouble(OrderOpenPrice()-0*Point,Digits),OrderTakeProfit(),0,Red); return(0); } } } } } } }



Reply With Quote

