Home › Forums › Trading System Mentor Course Community › Trading System Brainstorming › Volume and Turnover fixed values vs adaptable
- This topic is empty.
-
AuthorPosts
-
January 20, 2016 at 7:16 pm #101399SaidBitarMember
When backtesting a system normally we run it on good number of years in my case i normally use from 2000 till today or 1995 till today. The good thing is that i will have enough history and market conditions to understand how the system performed in them. The thing that sometimes does not resonate well with me is that we are coding the volume and turnover in the system such as Min of 500K/500K$.
I do not think that back in 1995 the number of traders and the volume was as high as today because 500K shares average of some number of days or 1M shares as average may be will mean that the stock was highly liquid in 1995 but today with the current volume it is normal.
In order to compensate for this I tend to use OR instead of AND for volume and turnover conditions somehow it solves the problem for the 90s but create the problem for the recent history since turnover of 500K$ will require 100K shares average on a 5$ stock, and in theory if the strategy is profitable the position size will be more than 5% of the turnover .
Here is an example just to make things clear suppose the hard coded conditions for average TO is 500K$ and the average Vol is 500K shares and the relation between the conditions is OR so it is enough that one of the conditions is satisfied. and let us assume that the strategy’s equity reached 5M$ at recent days and the share price is 5$, so according to position sizing of 5% of equity for each stock then the position value will be 250K$ which represents huge %age of the turnover of the stock.
isn’t this leading to a optimistic results in the back test.
What i am thinking does at add any value or reality if the volume/turnover became non fixed value instead maybe an equation such as 500,000 *(ABS (1995 – year() )/5+1)[ the formula is just from the top of my head ] it will simply add 100K for each year.
January 20, 2016 at 8:19 pm #102422Nick RadgeKeymasterGreat observation.
We have looked at this in the past. Our solution was to find a base average volume at the start of the test period and then use a CPI adjusted volume/turnover on every following year.
CPI = 3% as an example
That said, with the advent of modern technology and openess of markets you may want to increase the CPI to a higher level.
January 22, 2016 at 2:24 am #102423ScottMcNabMemberHi,
I have thought about the issue of liquidity filters previously and have started using the following (using fixed position size of 5% in keeping with thread)numbershares = equity()*0.05/close;
buy = (buy conditions)
AND volume>2000*numbershares
AND MA(volume,100)>2000*numbershares;I was going to ask about this when I was further into the course but on reading the post I thought it may be worth asking now. The value of 2000 is completely arbitrary and I have no idea whether it is appropriate. I suspect 100*numbershares is going to be unrealistic as owning 1% of the turnover would skew the buy and sell price making the backtest unrealistic. The aim is to obviate the effect in inflation by removing price from the calculation but this approach may have a whole lot of other issues that I am unaware of.
Cheers
ScottJanuary 22, 2016 at 3:18 am #102433Nick RadgeKeymasterWhat about where the position doesn’t exceed n% of the average daily volume, where n = 10?
January 22, 2016 at 3:23 am #102434Stephen JamesMemberThe equity() function returns single symbol equity, not portfolio equity. I’m not sure which you were intending.
Tracking portfolio equity for such calculations cannot be done in normal backtester mode so perhaps a derivative of price and/or volume may be a better option.
January 22, 2016 at 3:53 am #102424ScottMcNabMemberThanks Craig….Is the following use of the term equity referring to portfolio or single symbol please ? I have (incorrectly ?) used it believing it to be the portfolio..
SetPositionSize(2,spsPercentOfEquity);The actual code I have been using is:
SetOption(“maxopenpositions”,50);
a = SetPositionSize(2,spsPercentOfEquity);
SetOption(“CommissionMode”,1);
SetOption(“CommissionAmount”,0.2);
SetOption( “allowsamebarexit”, False) ;
SetOption(“InitialEquity”,100000);
shares a*.02)/Close;Buy = Buy1
AND IsIndexConstituent(“$SP1500”)
AND MA(Volume,100)>2000*shares;Sorry Nick, I did not grasp the bit about n=10…apologies
Many thanks for the assistance.
ScottJanuary 22, 2016 at 4:26 am #102435Stephen JamesMemberYes, SetPositionSize(2,spsPercentOfEquity); will use a % of portfolio equity in the backtester.
However, that portfolio equity is not accessible on a bar by bar basis for this case so the calculations involving ‘a’ and ‘shares’ will not work. A good way to check those sorts of things is to write the value to the interpretation window to see what value they return. If you are not familiar with the interpretation window yet, it is not far away in the course.
January 24, 2016 at 12:42 am #102425ScottMcNabMemberHi Craig,
Am I getting warmer ?SetOption(“maxopenpositions”,100);
SetPositionSize(1,spsPercentOfEquity);
SetOption(“CommissionMode”,1);
SetOption(“CommissionAmount”,0.2);
SetOption( “allowsamebarexit”, False) ;
SetOption(“InitialEquity”,100000);
PortEquity = Foreign(“~~~EQUITY”, “C” );
NoShares = PortEquity*.01/Close;Buy = Buy1
AND MA(Volume,100)>1000*NoShares
AND IsIndexConstituent(“$SP1500”);Thanks
ScottJanuary 24, 2016 at 4:16 am #102512Stephen JamesMemberMy understanding is that Foreign(“~~~EQUITY”, “C” ) data is populated after a backtest and the values are not available in the way you are trying to use it in standard backtesting mode.
There is also some contention as to its accuracy so it may be something to avoid.
As I mentioned, a derivative of price and/or volume may be a better option.
January 24, 2016 at 10:24 am #102426ScottMcNabMemberThanks Craig…thought I had it. I have not done the module with the interpretation window so I tried to verify it using what I had covered so far by adding:
Filter = Buy;
AddColumn(PortEquity,”Portfolio Equity”,1,colorDefault,colorDefault,100);
AddColumn(Close,”Close”,1.2,colorDefault,colorDefault,100);
AddColumn(NoShares,”Number of Shares”,1,colorDefault,colorDefault,100);I got the same results for the number of shares in both the exploration and backtester for a number of random stocks but it seems I am barking up the wrong tree altogether and will let it go.
Cheers
ScottJanuary 25, 2016 at 12:17 am #102523Stephen JamesMemberI like your use of the explorer to debug – its a valuable tool. Well done.
January 25, 2016 at 1:53 pm #102583SaidBitarMemberthere is this option it will help, but the problem it will compare only to the volume of the last bar
the other option I did not test it yet may be it will work
poistionsize = MIN(-5, MA(V,20)*BuyPrice*0.05);
in theory this will compare the 5% of the equity with the 5% of the average volume
January 25, 2016 at 9:48 pm #102586Stephen JamesMemberJust be aware that is using Buy Price which could be an issue. For example, If you are buying on the open then you are computing the MA’s on the same bar at the end of the day, having already bought at open. It may or may not make much of a difference, but something to test.
As an alternative, you could use the previous close or price on which the position sizing is done, as well as previous day’s volume.
January 26, 2016 at 10:01 am #102590SaidBitarMemberThanks Craig
this makes perfect sense to use the previous close instead of the Open.
may be it will be also good if we add some variable to the minimum volume required since the volume is increasing with years and the minimum volume should not be the same in 1995 as in 2015
still i have to test it but what i have in mind is one thing link this
StartingYear = Param(“Backtest Starting year”,1995,1985,2050,1);
Coef = 2^((year() – StartingYear )/10);
MinVolume = Param(“minimum required volume”, 300000, 1000, 10000000, 100) * Coef;the result should be something like this
Year—Coef—Min Volume
1995—1—300000
1996—1.07—321000
1997—1.15—345000
1998—1.23—369000
1999—1.32—396000
2000—1.41—423000
2001—1.52—456000
2002—1.62—486000
2003—1.74—522000
2004—1.87—561000
2005—2—600000
2006—2.14—642000
2007—2.3—690000
2008—2.46—738000
2009—2.64—792000
2010—2.83—849000
2011—3.03—909000
2012—3.25—975000
2013—3.48—1044000
2014—3.73—1119000
2015—4—1200000
2016—4.29—1287000January 26, 2016 at 8:47 pm #102593Nick RadgeKeymasterQuote:may be it will be also good if we add some variable to the minimum volume required since the volume is increasing with years [/quoteWe’ve now come full circle to my initial comment that using a CPI adjusted volume increase where the base could be 1995 @ 300,000
A CPI increase is a less arbitrary approach and has some kind of merit.
-
AuthorPosts
- You must be logged in to reply to this topic.