Home › Forums › Trading System Mentor Course Community › AmiBroker Coding and AFL › BatchTrader variable position number and size
- This topic is empty.
-
AuthorPosts
-
December 2, 2016 at 12:04 am #101595ScottMcNabParticipant
I would be keen to hear thoughts from the group regarding this topic before I approach Levente.
Example: MOC system typically has 20 positions at 10%
If, on open, 40 positions are triggered, I would prefer Batchtrader to sell 1/2 of all positions rather than 100% of 20…so would end up with 40 at 5%.
If there were 50 positions, it would adjust so had 50 positions at 4%….the user would enter the leverage wanted (eg 200%) and the standard number of positions (eg 20) but then if variable position no/size option is ticked Batchtrader would do the calculation (at the open) to keep all positions at a reduced position size (eg 200/number of positions)Not sure if I have explained that well enough?
December 2, 2016 at 1:52 am #105887TrentRothallParticipantWould you be able to test this though?
December 2, 2016 at 3:13 am #105890JulianCohenParticipantIn all my systems I get better results with 20 @ 10% than 40 @ 5%
I don’t know why, as I always expect more entries to give me a better result, but in fact a higher % is the thing that works.
In my MOC I get better results with 30@10% then with 40 @ 10% which seems even more arse about face to me.
Am I missing something? maybe it’s my definition of ‘better’
December 2, 2016 at 9:14 am #105891ScottMcNabParticipantTrent Rothall wrote:Would you be able to test this though?I’m not sure. If the backtester can derive the number of buysignals each day then it should be possible to do it ?
December 2, 2016 at 9:24 am #105893ScottMcNabParticipantJulian Cohen wrote:In all my systems I get better results with 20 @ 10% than 40 @ 5%I don’t know why, as I always expect more entries to give me a better result, but in fact a higher % is the thing that works.
In my MOC I get better results with 30@10% then with 40 @ 10% which seems even more arse about face to me.
Am I missing something? maybe it’s my definition of ‘better’
I am not looking to do it to get a better system but rather I am trying to get my backtest to be closer to reality. At the moment on the days when there are significantly more buy signals than positions available then the live results are diverging enough to make me uncomfortable.
Last night I got 42 buy signals for 25 positions. I ran 100 backtests and the results I got live were 99 out of 100 the worst it could have been. I had a similar experience in Sep…only twice in 4 months but if it could be eliminated by making a change to BatchTrader I can’t see why not to do it.
December 3, 2016 at 10:48 am #105895SaidBitarMemberScott McNab wrote:Trent Rothall wrote:Would you be able to test this though?I’m not sure. If the backtester can derive the number of buysignals each day then it should be possible to do it ?
I think it can be backtested as follows:
1- remove the parameter for random entries/trade skipping
2- Set the max allowed positions to 200
3- you will control the number of positions from the position size
4- create new ticker and add it to the number of stocks on daily basis that opened bellow your limit order
5- create new condition for entry but this condition should be optional only true if the number of stocks in your newly created ticker is more than the normal max (20 or 25 ..)
6- in case point 5 is satisfied then the only buy signals are the ones that have their open <= limit order
5- modify position size in case point 5 is true then pos size = 200/number of positions (coming from the new ticker)this will give you the exact figures and due to no trade skipping the backtest should be exactly as the reality.
in case you are happy with the results then you can modify the API.
In case you found any problem coding it please inform me i will help you.
but as Julian mentioned the smaller the position size the less attractive the system this is due to the fact that cost is high in comparison (2$ on x $ is not the same as 2$ on 2x$)
another thing the MOC most of the profits are small the margin (2:1) is the one that is boosting the percentage a bit up.December 3, 2016 at 11:09 am #105902SaidBitarMemberone more condition that is important is that IB will not allow you to exceed certain value that is 4:1 on US stocks and no idea what is the ratio on ASX so this condition should be added since after you reach this amount TWS will not place any more orders and will give error that no sufficient funds
December 3, 2016 at 8:39 pm #105894AnonymousInactiveJulian Cohen wrote:In all my systems I get better results with 20 @ 10% than 40 @ 5%I don’t know why, as I always expect more entries to give me a better result, but in fact a higher % is the thing that works.
In my MOC I get better results with 30@10% then with 40 @ 10% which seems even more arse about face to me.
Am I missing something? maybe it’s my definition of ‘better’
I think this is a result of two things:
1) fewer positions at a higher position size will give better results because you will have a higher exposure rate generally. think about all the days when you have a max of 30 positions trigger. if the position size is 10% you will be 300% invested whereas if it is 5% you will only be 150% invested. you should get higher CARs with the higher exposure
2) by having bigger size / fewer positions you are introducing more selection bias – this will skew your results to look more favorable than they will be in reality. more positions / smaller size is a more accurate portrayal of reality.
December 3, 2016 at 9:36 pm #105904Nick RadgeKeymasterJulian – exactly as Brent has put it on both elements.
December 3, 2016 at 9:52 pm #105888ScottMcNabParticipantI haven’t been able to design a MOC system without the odd day every month or two where buysignals are greater than positions available..in this case were 42 buysignals and 25 positions available. I ran 1000 backtests to look at a bit more and it was the 986/1000 in terms of worst possible outcome.
From my limited understanding, the backtest assumes that the probability of any trade being selected is equal however it seems unlikely with a score of 986/1000 (from this very small sample). I had a similar experience in Sep. It may well be that the stocks that fill on the open are less likely to be winners than stocks that fill later during the day.
I don’t see any way around this short of trying to use intra-day data. I wonder if there is any way to force the backtest to assume the worst possible outcome for each day ? I understand the 20% trade skip is probably serving a similar function.
December 3, 2016 at 9:54 pm #105903ScottMcNabParticipantSaid Bitar wrote:Scott McNab wrote:Trent Rothall wrote:Would you be able to test this though?I’m not sure. If the backtester can derive the number of buysignals each day then it should be possible to do it ?
I think it can be backtested as follows:
1- remove the parameter for random entries/trade skipping
2- Set the max allowed positions to 200
3- you will control the number of positions from the position size
4- create new ticker and add it to the number of stocks on daily basis that opened bellow your limit order
5- create new condition for entry but this condition should be optional only true if the number of stocks in your newly created ticker is more than the normal max (20 or 25 ..)
6- in case point 5 is satisfied then the only buy signals are the ones that have their open <= limit order
5- modify position size in case point 5 is true then pos size = 200/number of positions (coming from the new ticker)this will give you the exact figures and due to no trade skipping the backtest should be exactly as the reality.
in case you are happy with the results then you can modify the API.
In case you found any problem coding it please inform me i will help you.
but as Julian mentioned the smaller the position size the less attractive the system this is due to the fact that cost is high in comparison (2$ on x $ is not the same as 2$ on 2x$)
another thing the MOC most of the profits are small the margin (2:1) is the one that is boosting the percentage a bit up.Many thanks Said. I will go away and give this post the attention it deserves and see if I can work it out.
December 3, 2016 at 10:21 pm #105908ScottMcNabParticipantHmm..for those out there who can code…..is it possible to do 10 run thru’s for EACH day (ie a daily backtest) with trade skip zero and with PositionScore = mtRandom() and then to sum the worst result for each day to create a new ticker ?
-
AuthorPosts
- You must be logged in to reply to this topic.