here is a script, i have written, i hope it's gonna help u
//+------------------------------------------------------------------+ //| avrge_per_symbol.mq4 | //| Copyright © 2010, NADAV. | //+------------------------------------------------------------------+ #property copyright "Copyright © 2010, NADAV." //+------------------------------------------------------------------+ //| script program start function | //+------------------------------------------------------------------+ int start() { //---- double Lots = 0.0; double Profit = 0.0; double OCP = 0.0; double average= 0.0; int OT = 0; for (int i = OrdersTotal() - 1; i >= 0; i--) { OrderSelect(i, SELECT_BY_POS, MODE_TRADES); //----- if (OrderSymbol() == Symbol() && OrderType() == OP_BUY || OrderType() == OP_SELL) { Lots = Lots + OrderLots(); Profit = Profit + OrderProfit() + OrderCommission(); OCP = OrderClosePrice(); OT = OrderType(); } } double pips = Profit/Lots/MarketInfo(Symbol(),MODE_TICKVALUE); if (OT == OP_BUY) { average = OCP - (pips*Point); } if (OT == OP_SELL) { average = OCP + (pips*Point); } Alert ("Lots = ", Lots); Alert ("Profit = ", Profit); Alert ("pips = ", pips); Alert (DoubleToStr(OCP,5)); Alert ("average is: ", DoubleToStr(average,5)); //---- return(0); } //+------------------------------------------------------------------+
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Hi,
I have below positions
Long-1 lot - @1.34
Short-2 lot - @1.35
Long-5 lot - @1.33
Can someone please tell me the formula to calcuate the break even price when LONG profits (bcz total LONG lot size is bigger that SHORT so at some point it breaks even)
thanks in advance