Stupid Question (probably) regarding Pip Value in Base Currency
Stupid Question (probably) regarding Pip Value in Base Currency
18 Dec 2015, 13:08
Hi
This is probably a stupid question, and apologies if it is, but I can't get a straight answer off anyone. I'm trying to write a robot which calculates profit when the following confusion arose.
Example scenario (ignoring any trading commission)...
Account currency: EUR
Currency pair: EURUSD
Volume 100,000 units
I buy the EURUSD when it is trading at Ask 1.00020, Bid 1.00010
I then close the position when the EURUSD is trading at Ask 1.00040, Bid 1.00030
A profit of 1 Pip (Bid of 1.00030 - Ask of 1.00020)
What is my profit in the base/account currency of EUR?
Is it...
a) 100,000 * (0.0001 / 1.00040), i.e. using the closing Ask rate, or
b) 100,000 * (0.0001 / 1.00030), i.e. using the closing Bid rate
And likewise, if I were to make a profit of 1 Pip by selling the EURUSD, which closing rate (Ask or Bid) should I use to calculate my 1 Pip profit in the base/account currency?
Kind regards
John Duffy
Replies
ikariya
21 Oct 2016, 19:12
Bit of a late post but since I've had the same confusions as the op and believe I know the answer, thought I should share... :)
John - both of your calculations A and B seem to be based on the assumption that you traded USD 100,000 and need to convert the value of 1 pip per US dollar back to EUR. If that were true, B would be the answer since 1.0003 is the price at which the position closed.
However, the 100,000 units you bought are actually in EUR already. And the amount of USD you bought (which would've been 100,000 / 1.0002 = 99,980 ... doesn't matter), has netted you a profit of EUR 0.0001 per unit. Therefore the calculation is as simple as 100,000 x 0.0001 = 10 euros profit exactly.
Funnily enough in your example all formulas would have produced 10.00 anyway due to rounding. ;) But this should be the correct (and simplest!) way to calculate.
--- On a side-note...
If your base currency doesn't match your account currency things get trickier, since volumes and prices are expressed in the base currency whilst all profit figures and commissions are expressed in the account currency. This forces you to actually do conversions between those currencies, e.g. when deciding volumes based on account balance (to control leverage/risk) or doing profit projections like the one you posted.
It wouldn't be so bad if not for a big limitation in cAlgo - the fact that it throws an error when you attempt to access other symbols during a back-test! The only workaround I know of is to use Symbol.PipValue (which is actually the value converted to your account's currency) but sadly it only seems to get set when your bot first starts up. i.e. It never updates, even during a live run...! Not exactly accurate. :(
So yeah, expect some pain if you ever want to trade on a different base currency. If anybody has a nice solution to this I'd be very grateful.
@ikariya
kricka
20 Dec 2015, 03:13
Hi John,
have a look at this cBot and try it out to get an estimate of the profit per pips. Traders Aid 1.0 cBot
To code in cAlgo and to get all the information out of the cAlgo API there is a learning curve and a lot of trial and error until it works to one's satisfaction. Also there are many hints in different threads on the forum from excellent programmers sharing their views and coding snippets. The API documentation is however a good source to get the basics needed and by reading the threads on the forum and by testing the suggested code snippets out, is the way to go. Spotware hopefully will make a really good upgraded to the instruction manual for the API and we all are waiting for it, it's overdue and it's needed to be released soon.
@kricka