breakeven calculate

To add comments, please log in or register
javiervillagran96
116
javiervillagran96  

how to calculate the distance so that two or more open trades reach a breakeven.

paul selvan
627
paul selvan  

here is one example:

void OnTick(){
   double sumProfits=0;
   bool checked=false;
   
   for (int pos=0;pos<OrdersTotal();pos++){
      if (!OrderSelect(pos,SELECT_BY_POS)) continue;
      if (OrderType()>=2) continue;
      sumProfits +=OrderProfit();
      if (!checked) checked=true;
   }  
   
   if (NormalizeDouble(sumProfits,0)==0 && checked) Alert("Breakeven reached");   
}


William Roeder
20228
William Roeder  
javiervillagran96: how to calculate the distance so that two or more open trades reach a breakeven.

Break even price = Lots weighted average price.
          OrderOpenPrice question . - MQL4 programming forum
          looking for sample code on how to calculate the price BE for a few Buy and Sell orders simultaneously - Pips - MQL4 programming forum

To add comments, please log in or register