Backtest help needed

Hello Friend,

My backtest result differ when I changed the Initial equality.

Case 1. when Initialy Equality = 100,000

In Explore 6 tickers come while in backtesting only two tickers come

Backtest result
2

Explore result
exploration_20

settings

case 2. when Initialy Equality = 1,000,000

Backtest result

settings

this is perfectly fine.
Just need to understand why the other 4 tickers are not coming when Equality is set to 100,000.

position setting code

//setting position size. 

SetPositionSize(60, spsPercentOfEquity); 

I suggest you start by going to Analysis Settings / Report and enabling Detailed Log. Run your backtest again to get more information about what AmiBroker is doing with your entry and exit signals during the second phase of the backtest.

Also see this post: How do I debug my formula?

Finally, as a general rule you need to include all of your code or else others are just guessing at what you're doing. Most people here don't have the time or patience for guessing games.

2 Likes

Thanks Mradtke,

It helped me, found the reason.

Would be nice if you would post the reason you found :wink:

Hi Henri,

can find the reason below
6

see the issue here, MRF share price is around 73K and min share need to take is 1.
but I have only 60K balance, which is not possible to take it. due to this reason other tickers ignored. since they are generated at the same time.

Thanks.

Why does it ignore the other entries.... would be my question...

The other entries still qualify.

Orders are entered in order of PositionSCORE. The original poster does not use position score (while he should) as we clearly see in detailed report (all scores set to -1). Recommended reading for everyone Portfolio-level back testing

In the absence of positionscore, position size is used or if equal, alphabetical order.

If an "not sufficent funds" happens with higher-ranked symbol, remaining, lower-ranked signals are ignored because it would always lead to entering lowest ranked symbols (something that you don't want).

You should set up your PositionScore so signals are ordered in a way you prefer to enter trades.

Quite obviously with 60% of requested position size that original poster did, it is unlikely to enter more than 1 position (as this single position will already use 60% of available equity and the leftover is just 40%)

If you really wanted to enter that trade, you should be using "Allow position shrinking". (that is ON by default, by the way - so you deliberately switched it off - don't change defaults UNTIL YOU READ THE GUIDE what each setting does)

1 Like

Thanks for that clarification.

This topic was automatically closed 100 days after the last reply. New replies are no longer allowed.