Walk Forward Initial Capital Issue


#1

Hi Guys,

I am using WFO engine, and the problem I have found is that the initial capital for each run is equal to the sum of netprofit of the previous runs, this would be a problem for me because it distorts the %netprofit, which is the one I need to see.

The questions is, what can I do in order to set initial equity at 100000, for each run in WFO engine?

Thanks,
Javier


#2

It does NOT distort %profit. Actually the way it is done now allows proper calculation of all metrics for all OOS backtest segments. If you are not compounding you should be using constant position size.

But if you really want starting with same equity for each segment, it was so BEFORE version 5.56.0 (see Release Notes). So you can use 5.55 or earlier.

CHANGES FOR VERSION 5.56.0 (as compared to 5.55.1)

New Analysis: A new walk-forward summary report that covers all out-of-sample steps
There were significant changes to walk forward testing made to allow summary out-of-sample report.
The most important change is that each subsequent out-of-sample test uses initial equity equal to previous step ending equity.
(Previously it used constant initial equity).
This change is required for proper calculation of all statistics/metrics throughout all sections of out-of-sample test.


#3

Hi Tomasz,

Can I have 2 amibrokers installed?

1 for the latest version and the other one for 5.55. Also, where can I download the version from?

Gracias,
Javier Chen


#4

Old versions are available to registered users only. You have to contact support from registered email to get the link.


#5

Hi,

Ok, amibroker was bought by our CFO as it is for institutional purposes, but I guess we’ll try to change the registered email to mine for convenience. Also, I sent you another email regarding to why I thought that %net profit was not accurate, since the sizing variations were so high (they were from similar dates), which should not be as positionsize=-10. The issue I see with the sum of the net returns of each WFO run being the initial capital is that when, initial capital gets too high, and there are not enough shares to be bought, I am using 1 week steps for 3 years projection, so the initial capital becomes the sum of 52 weeks, and gets extremely high.

The reason I am using 1 week steps is because I am trying to do a rolling backtest instead of a WFO (I declare a optimizable variable that is not used in any function), in order to see that the returns I am getting are not because of the return of any particular stock (luck) I have bought (as the holding periods are really long). So I tell the system to buy a new portfolio every single week.

On the other hand, I was banned from posting in the forum, can you comment on the reasons why I was treated that way?

Gracias,

Javier Chen

cid:BC34D799-3476-41D4-89C4-08F08406E2B8


#6

You were not banned - if you were you would not be able to post (including this one).
Posts may be not accepted if they are NOT following FORUM RULES, that apply to everyone.
For example your posting without proper CODE TAGS is against forum rules. So you should be actually glad that this post was accepted even though it violates the rules.

You should FIX your post using "Edit" feature so the code is properly formatted as per forum rules.

So why are you treating the FORUM "that way" (not reading & following the rules)? The forum is public place (like theater or opera) where you are expected to read (or know) the rules first and follow them.

Also if you read just 10 seconds about discourse ("the introductory info" sent to every new joiner) you would know that what you assummed as ban is just a feature of Discourse that prevents people who just joined to send tons of spam. That is one of the reasons why this forum is spam-free. This forum is not Facebook or similar trash site. We have rules here, we keep site tidy, properly formatted and aesthetics are important here.


#7

Hi, I apologyze for not having read the rules.

Also, since I am receiving emails and then replying them, when you reply I though we were having a private conversation.

I have been trying to edit my previous code but can't find the edit button.

Lastly, the email I was talking about in my previous comment

Also, I sent you another email regarding to why I thought that %net profit was not accurate, since the sizing variations were so high (they were from similar dates), which should not be as positionsize=-10. The issue I see with the sum of the net returns of each WFO run being the initial capital is that when, initial capital gets too high, and there are not enough shares to be bought, I am using 1 week steps for 3 years projection, so the initial capital becomes the sum of 52 weeks, and gets extremely high.

The reason I am using 1 week steps is because I am trying to do a rolling backtest instead of a WFO (I declare a optimizable variable that is not used in any function), in order to see that the returns I am getting are not because of the return of any particular stock (luck) I have bought (as the holding periods are really long). So I tell the system to buy a new portfolio every single week.

This is the image:

uyfg


#8

PosSize = -10 means 10% of current portfolio equity. As portfolio equity changes so 10% is from different value is different too. Nothing wrong with that.
Recommended reading
http://www.amibroker.com/guide/h_portfolio.html
http://www.amibroker.com/guide/a_equity.html
http://www.amibroker.com/f?setpositionsize


#9

Hi,

I understand that possize=-10 means 10% of current portfolio equity, and that was also my intention. But if you see the trade for SGEN (3rd trade) on 3/11/2006 the pos value was 307k, however, the trade for ATO (4th trade) on 10/11/2006 (just one week later) the pos value was 3732k (10 times as much), thus, unless the initial equity has gone up 10 times in just 1 week (which it didnt), the pos value is not right.

For better illustration, if we compare the 1st trade (BKD) with the 7th trade (TTWO), they both were taken on the same date, however, pos value for BKD was 8.8 Million and pos value for TTWO was 22.1 Million, almost 4 times higher. I understand that possize=-10 equals 10% of curren equity, as equity changes your possize vary, but, they should be similar when trades are taken on the same date, variations by a factor of 4 in this case is too high.


#10

Which trade is the correct size? The BKD trade with value 8.8M or the TTWO trade with value 22.1M? If you have not done so already, you may want to look at the Portfolio tab of the Analysis Settings to see if you have a value specified in the field for "Limit trade size as % of entry bar volume", as this is one possible cause of AB reducing your position size.

Going to the Report tab of the settings and selecting Detailed Log instead of Trade List is a good way to get more insight into how AB is sizing your positions.


#11

Yes "Limit trade size as % of entry volume" is the very first thing you should check, see: Strange backtesting results for large accumulated returns

And detailed log as I mentioned in first reply.