- Trading Principles - Trade - MetaTrader 5 for iPhone
- Trading Principles - Trade - MetaTrader 5 for Android
- Close By - Trade - MetaTrader 5 for Android
Francesco Fava:
If buy I calculated the difference between Ask-OpenOrderPrice And if sell between OpenOrserPrice-Bid and then converting in pips . Then at the end summing pips on each order.
- You've got it correct
- "wrong in something" is meaningless - just like saying the car doesn't work. Doesn't start, won't go in gear, no electrical, missing the key, flat tires - meaningless. We can't see your broken code. There are no mind readers here and our crystal balls are cracked.
- You've got it correct
- "wrong in something" is meaningless - just like saying the car doesn't work. Doesn't start, won't go in gear, no electrical, missing the key, flat tires - meaningless. We can't see your broken code. There are no mind readers here and our crystal balls are cracked.
for (int cnt = OrdersTotal() - 1; cnt >= 0; cnt--) { if (OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES) && OrderSymbol() == Symbol()) { if (OrderMagicNumber() == MagicS) { gProfit += OrderProfit(); // add Swap and Commission if you care gOrdersCount += 1; gLots += OrderLots(); gWeightedAverage += OrderLots() * OrderOpenPrice(); } } } if (gLots > 0) gWeightedAverage /= gLots;
make sure you init the vars to 0
at the end of this you will all your heart desires -> Profit, Ordercount, Total Lot Size and and average order open price.
you now can use this average order open price similar to how you used diff1 before. Example = ( (gWeightedAverage - Bid) / Point) / Point_Compat. and then normalize it
make sure you init the vars to 0
at the end of this you will all your heart desires -> Profit, Ordercount, Total Lot Size and and average order open price.
you now can use this average order open price similar to how you used diff1 before. Example = ( (gWeightedAverage - Bid) / Point) / Point_Compat. and then normalize it
I used EquitySentry and my EA and the floating profit / loss doesn't correspond
Your function seems correct to me. Maybe is there some commissions on your account ?
Then do not confuse points with pips.
double DiffPips = (NormalizeDouble(((Ask - diff1)/MarketInfo(Symbol(),MODE_POINT)),(int)MarketInfo(Symbol(),MODE_DIGITS)))/_Point;
double GetProfitOpenPosInPips(){ double pr=0.0; for(int i=0; i<OrdersTotal(); i++){ if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES)){ if(OrderSymbol()==Symbol() && OrderMagicNumber()==gMagicNumber){ if(OrderType()==OP_BUY){ pr+=(OrderProfit()/OrderLots()/MarketInfo(OrderSymbol(),MODE_TICKVALUE))/10; } if(OrderType()==OP_SELL){ pr+=(OrderProfit()/OrderLots()/MarketInfo(OrderSymbol(),MODE_TICKVALUE))/10; } } } } return (pr); }Please note that MODE_TICKVALUE is used, your account currency is important at this point.
Please note that MODE_TICKVALUE is used, your account currency is important at this point.
This topic is about Pips PL, nothing to do with tick value.

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use