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
Ok I read the difference between TICK_VALUE & TICK_SIZE, I updated the code but see my problem, try on your account for example:
In this sample, my Ticket is #8787249 for XAUUSD and this is OP_SELL order.
P: 292.650 = OrderProfit()
myP: 390.900
TickValue: 1.00
TickSize: 0.01
Point: 0.01
Any idea why P != myP ?
It works for me. It's better to use :
MathAbs(OrderClosePrice() - OrderOpenPrice ())...
for an open trade OrderClosePrice() gives you the current price.
As WHRoeder said, there is something weird, as your broker.
thanks for info. yes this is a hardcoded test. but this is the same symbol of course.
I'm writing to them
@angevoyageur thanks for OrderClosePrice() use I though it was only available when closed (in history pool).
So I've udpated the whole code below. Then asked my broker why there is so much difference, I doubt on a bug from them but well will wait their reply!
Thank you to all of you guys
I just found something interesting !
On MT4 => click right on the Profit column => in the popup => Profit then we can change the display in "as point", "as term currency or "as deposit currency".
Well If I displayed in "as term currency, the value is exacly the same as my formula.
But in OrderProfit() this is the value of "as deposit currency".
I don't understand very well those to display mode. Do you think the difference is the spread currency take by the broker ?
Interesting - I thought OrderProfit() was always in account currency.
The spread has nothing to do with your problem.
If I open an account in USD and trade the EURUSD for example. A pip change is always $10.00 USD/lot (exactly.) USD is the account currency (your currency invested)
If I open an account in EUR and trade the EURUSD, a pip change is still always $10.00 That is the "currency to term." But the change to account is $10 USD * 1.334 EUR/USD (exchange rate) or 13.34 EUR.
The value of a pip depends on exchange rates when the quote currency is not the account currency.
Got it. Yes exactly I found this also this morning . It dependent of the position currency and your account currency but now I can update the formula by taking care of and give you a nice function in few moments.....
This function will calculate your exact money invested in your account currency + your protected balance.... come back soon ;)
Now we are set, this topic is a conclusion (for me) and some people asking me: How much total I'm risking ? What are my potential earnings, etc....
Amount are displayed in your account currency.
(PS: We can also minor the Equity information by removing total swap & commission fees).
Edit: * fixed improved version @ 2013-09-17 14:49 GMT+1 !