positionsize as nominal value
01/28/2022 at 12:11 PM #186829
So, I was thinking of ways to make backtests more accurate and realistic, one thing I’d seen mentioned elsewhere is the anomaly of nominal value. If today my capital would allow a position of €1 pp on the DJ, I would be looking at a nominal value of €34,100. To test that same level of exposure 10 years ago would require €2.7 pp
Would a backtest be more useful if it could use a constant nominal value, as opposed to a constant amount per point ?
if so, how could it be coded?
I tried using1positionsize = (34100/close)
but it doesn’t work. Is there another way to do it? Does it even make sense to try ?01/28/2022 at 12:33 PM #18683401/28/2022 at 12:53 PM #186835
the first time i tried it returned zero trades – nada – but I just tried again with a different algo and yes, it does seem to work. 😁 no idea what went wrong.
It gives some interesting results, esp with drawdown. I’ll have to play around with it a bit more to see if it’s actually useful.01/28/2022 at 2:38 PM #18684501/28/2022 at 2:58 PM #186846
yes, probably the first time I tried it the capital was set too low. It’s working for me now.
Do you find it gives you a better picture of past performance?
My initial results definitely show a straighter equity curve. Also fills out the histogram, where previously the historical returns appeared much lower due to a comparably smaller exposure value.
But the Drawdown seems to be much higher…01/28/2022 at 3:56 PM #186850
Actually I never work with a fixed position size. But when I compare the same backtest with fixed/variable position size, I dont remind any “problematic” difference
On the other hand , working with a fixed position size on equity indices is a way to give less importance to old market data…01/28/2022 at 4:13 PM #18685101/28/2022 at 4:43 PM #186857
I want to invest 30 000 euros – only for backtests 🙂 – at each trade so if the value of the point is 2 eur (for example euro stoxx 50) I need to divide by pointvalue (2 in this case)
Pipsize is the adjustment for forex in order to invest 30 000 eur too, but Im not 100% sure of the accuracy because I dont backtest forex strategies very often01/28/2022 at 4:58 PM #18686001/29/2022 at 6:33 AM #186921
Pipsize is the adjustment for forex in order to invest 30 000 eur too, but Im not 100% sure of the accuracy because I dont backtest forex strategies very often
What I do is “set” a currency relation at some stage of backtesting. For example, in my EUR/USD code I have a hard-coded 1,20 or something like that (1,00 EUR = 1,20 USD). This is my forever reference (all variables relate to that). Next the currency relation of the moment is determined prior to each trade. Thus for today this would be 1,11458.
This goes all in the mix at obtaining position. This automatically means that if I “today” buy for 400,000 euros the EUR/USD pair, it implies 4.31 contracts (see 1st attachment from Jan 27). Apparently this was 4.26 contracts on Dec 23. I don’t even know that; I invest the 400,000 euros and want to see profit regarding *that*. … But this is obviously also how the backtests operate. No matter how far they go back, the investment remains consistent over time and the profit or loss can always relate to that (which is a mind thing too 🙂 ).
The sheer reason I did this, is because there is an other relation between the cost of a trade and the investment. This may not be so (really) when the cost is payed by spread, but with commission this is different. Anyway point is : we only make profit when the costs have been payed first, and these too are subject to currency influence first (if I pay commission in USD to a USA broker (IB) and the fee is in USD, you tell me what I pay for commission would I trade the EUR/ZAR, knowing that my account is in USD for IB but in EUR for IG).
My code is a complete madhouse because of it, but it is worth while. I won’t ever fall in the pitfall which changes all “tensions” (currency relations) over time, my backtest showing gain while in the end it is loss because of, for example, not taking into account sufficient commission, or plain wrong commission (like USD 30 for a trade of 400,000 ZAR ? hahaha, really not. But trading 400,000 EUR and that making 6,957,540 ZAR of it, yes. And what is the commission ?).
Go ask support how this all works, and they won’t even know what you are talking about and why. Wrapping your head around currencies is not easy at all. On a weekly basis I may find again another value (variable) I already used, but which relates to currency somehow and that I forgot to make it subject to that. Some times it is even hard to determine. Some times all is so much strangled that I can’t change one variable any more (make it subject to currency), unless I re-examine all of the code, which is quite undoable – or else very dangerous because you won’t notice most of the faults right away.
Anyway message is : I work with money only. Thus *all* is converted to money which already also is a decision, because in which currency then. I decided EUR because I buy my food in EUR and will understand profit and losses in that context. I really won’t when the EUR/USD was over 1,60 only in 2008 with my account in USD for another reason (though obvious).
You must be logged in to access attached files.07/02/2022 at 10:41 AM #196606
Sorry I have found this topic so late but anyway I wanted to share the formula I use in my systems for PositionSize calculated in Euros. For me now is something essential for my backtesting in different assets and to run the systems with equivalent “risks”123Capital = 10000 //Valor en euros de cada operaciónRate = close //Cambio de 1€ en la moneda del activo. En Forex es la segunda divisaPositionSize = (Capital*Rate*pointsize)/(close*pointvalue)
(I can´t find the option to insert PRT code)
Capital: value in euros for each operation
Rate: exchange in euros for the currency of the asset. P.e. For the EUR/USD would be the “Close”, for the DAX would be 1, for USD/JPY would be the change for EUR/JPY and so on
If you use this you should consider also the minimun positionsize for each asset
1 user thanked author for this post.07/04/2022 at 10:07 AM #19671007/05/2022 at 6:08 AM #196765
The code as it is works only for EUR/USD, for other asset you should change “RATE” accordingly. As established in the previous message:
“Rate: exchange in euros for the currency of the asset. P.e. For the EUR/USD would be the “Close”, for the DAX would be 1, for USD/JPY would be the change for EUR/JPY and so on”
So for both DAX you comment you should write: RATE=1 and it will work fine.
1 user thanked author for this post.07/05/2022 at 9:33 AM #196768