nicolas74: I calculate the profit like : (open price - deal close price ) * 1000.
- Because 1000 is a constant and unrelated to the pairs. On EURUSD 1/Point = 1000 or 10,000 depending on 4/5 digit broker. On USDJPY 1/Point = 1/100 or 1/1000. Same for your pair. Don't hard code numbers.
- Even if you adjusted it correctly, your calculation is invalid unless your account currency matches the base pair. EURUSD on a USD account is always $10/pip/std lot. EURJPY on a USD account varies with price. Don't hard code numbers.
- Even if you adjust for those. The size of a lot (100,000 or 10,000) depends on the account, std or mini. Don't hard code number.s
- Remember there is always OrderProfit()
//double PipValuePerLot(string pair=""){return(DeltaValuePerLot(pair)*pips2dbl);} double DeltaValuePerLot(string pair=""){ //{Value in account currency of a Point of Symbol. // In tester I had a sale: open=1.35883 close=1.35736 (0.0147) // gain$=97.32/6.62 lots/147 points=$0.10/point or $1.00/pip. // IBFX demo/mini EURUSD TICKVALUE=0.1 MAXLOT=50 LOTSIZE=10,000 // IBFX demo/standard EURUSD TICKVALUE=1.0 MAXLOT=50 LOTSIZE=100,000 // $1.00/point or $10.0/pip. // // https://www.mql5.com/en/forum/127584 CB: MODE_TICKSIZE will usually return the same // value as MODE_POINT (or Point for the current symbol), however, an example // of where to use MODE_TICKSIZE would be as part of a ratio with // MODE_TICKVALUE when performing money management calculations which need to // take account of the pair and the account currency. The reason I use this // ratio is that although TV and TS may constantly be returned as something // like 7.00 and 0.0001 respectively, I've seen this (intermittently) change // to 14.00 and 0.0002 respectively (just example tick values to illustrate). // https://www.mql5.com/en/forum/135345 zzuegg reports for non-currency DE30: // MarketInfo(chart.symbol,MODE_TICKSIZE) returns 0.5 // MarketInfo(chart.symbol,MODE_DIGITS) return 1 // Point = 0.1 // Prices to open must be a multiple of ticksize //} if(pair == "") pair = Symbol(); return( MarketInfo(pair, MODE_TICKVALUE) / MarketInfo(pair, MODE_TICKSIZE) ); // Not Point. }
Thanks a lot for the infos
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
Hello
I'm using a practice account with OANDA and MT4 plateform.
I'm creating some report of my own and i got a trouble with LOT size on USDNOK.
I calculate the profit like : (open price - deal close price ) * 1000.
All my lots are 0.01.
It works for USDEUR and USDCAD nut not for USDNOK.
It seems that the 0.01 LOT for USDNOK is actually 180/181 instead of 1000.
Any idea ?
Thanks
Nicolas