how to use MA as breakeven?

 

how to use MA as  breakeven?

 
breakeven? to what?
 
i need to modify my breakeven function to place the breakeven on MA line, instead of a fixed value
 
double MAF=iMA(Symbol(),0,MAPeriod,0,MAMethod,MAPrice,i);

OrderModify(OrderTicket(),OrderOpenPrice(),NormalizeDouble(OrderOpenPrice()+MAF*point,digits),OrderTakeProfit(),0,Blue);
fex: i would like to use MAF variable as BE
 
The break-even of an order is where the OrderProfit()==0. You cannot use any value iMA gives you.
 
Perhaps you're looking for a trailing-stop when order profit is greater than or equal zero?
 
fulltilt:

how to use MA as  breakeven?

  1. a MA has nothing to do with break even. If you mean using a MA as a stop loss
    double MAF=iMA(Symbol(),0,MAPeriod,0,MAMethod,MAPrice,i);
    
    OrderModify(OrderTicket(),OrderOpenPrice(),MAF,OrderTakeProfit(),0,Blue);

  2. OrderOpenPrice()+MAF*point
    price + price * point is meaning less
 
This is not break even .. it can be called a trailing stop window updating with MA ... your code seems to be for BUY order ... You must also consider the allowed distance between ask/bid and stoploss / takeprofit by your broker.
Reason: