Forum Replies Created
-
AuthorPosts
-
LeeDanelloParticipant
Doesn’t the trade skipping in Monte Carlo Analysis meant to address the problem of selection bias? So establishing that you can only takes 75% of trades you could adopt a 25% trade skipping parameter to simulate expected results.
LeeDanelloParticipantThanks Said. You make it look easy
LeeDanelloParticipantTry Plot(Trailstop,”TrailStop”,colorAqua,styleLine);
LeeDanelloParticipantDo you think it’s a bug in the software?
LeeDanelloParticipantShould be an upgrade fee. Given the business you’ve given him, he should be providing you one at gratis
LeeDanelloParticipantCraig’s code works. I was trying an different angle without inputting the start and end dates.
If you use a constant TO filter in your backtest, it’s not strictly correct as the value of today’s turnover is different to that of 20 years ago. I’ve just made some adjustments to Craig’s formula.Code:TO = Volume*Close;CurrentTO = Param(“Initial Turnover – $”,700000,0,10000000,1000);
StartYear = Param(“Start Year”,2010,1995,2020,1);
EndYear = Param(“End Year”,2010,1995,2020,1);
noYears = (EndYear-StartYear+1);
TOInc = Param(“Average Inflation %”,1.03,0.01,10,0.01);
startTO = CurrentTO*(1-TOInc/100)^noYears;
Inc = (1+TOInc/100) ^ Max(0,Year()-StartYear+1);
IncTO = startTO * Inc;
Plot(IncTO,”IncTO”,colorRed,styleLine);LeeDanelloParticipantI think I understand what you’re saying.
Just wondering if i = 0 is the start of the quotations on the chart or the start of the backtest period?CurrentTO was meant to be a current year input so it would depend on the length of the backtest to back calculate what the turnover would be.
Code:CurrentTO[i] = MinTO*(1 – inflationRate /100/250)^( BarCount – 1 – i);The attached spreadsheet might show the logic more clearly.
LeeDanelloParticipantI’ve come up with this so far.
Code:TOTog = ParamToggle(“Turnover Filter”,”Off|On”,0);
Turnover = CloseArray*VolumeArray;
MinTO = Param(“Minimum Turnover – $”,500000,0,10000000,1000);
TOMA = Param(“Turnover MA”,10,1,200,1);
AveTO = MA(Turnover,TOMA);
inflationRate = Param(“Average Inflation Rate %”,0,0,100,0.01);
NoBars = 0;for (i = 0; i < BarCount - 1; i++) { NoBars++; } CurrentTO = MinTO; for (i = NoBars; i < BarCount - 1; i++) { { CurrentTO[i] = MinTO*(1 - inflationRate /100/250)^( BarCount - 1 - i); } } TOFilter = AveTO > CurrentTO AND Turnover > CurrentTO;
TOFilt = IIf(TOTog,TOFilter,1);The following is another solution albeit in Metastock code
Code:{Start}
{Metastock CPI (Australia) Turover Filter – written in Metastock v9 and will need to be modified for use after 2007}
Base:=500000;{Enter minimum system turnover for 2007 eg 500000}
YEARVAL:=If(Year()=2007,Base,If(Year()=2006,Base/1.033,
If(Year()=2005,Base/1.061,If(Year()=2004,Base/1.089,
If(Year()=2003,Base/1.115,If(Year()=2002,Base/1.148,
If(Year()=2001,Base/1.184,If(Year()=2000,Base/1.253,
If(Year()=1999,Base/1.276,If(Year()<=1998,Base/1.296,Base*20))))))))));{End} {If you wish to use this filter when back-testing copy from "{Start} to {End}" inclusive and paste it at the beginning of MetaStock exploration code. You will also need to amend the Turnover Filter in the EntryTrigger to show "YEARVAL" instead of an amount, for example, Mov(V*C,21,S)>=YEARVAL;}LeeDanelloParticipantThanks Craig,
I was wondering what function Amibroker might have to extract the the number of bars in a backtest range. Maybe something like this so you don’t need to input a date range.
Code:toDate = Status(“rangetodate”);
fromDate = Status(“rangefromdate”);
Range = toDate-fromDate;Maybe this is the answer for counting bars in a portfolio backtest
Code:bars = 0;for (i = 0; i < BarCount - 1; i++) { { bars++; } }
LeeDanelloParticipantI was thinking something along these lines
Code:TOTog = ParamToggle(“Turnover Filter”,”Off|On”,0);
Turnover = CloseArray*VolumeArray;inflationRate = Param(“Average Inflation Rate %”,0,0,100,0.01);
MinTO = Param(“Minimum Turnover – $”,500000,0,10000000,1000);
NoBars = lastvalue( cum( 1 ) ) – Cum(1); //This equals total number of bars.
//It should equal to the number of bars in the analysis range.
//The formula currently counts the bars from the RHE to the start of the chartCurrentTO = MinTO*(1 – inflationRate /100/250)^NoBars;
TOMA = Param(“Turnover MA”,10,1,200,1);
AveTO = MA(Turnover,TOMA);
TOFilter = AveTO > CurrentTO AND Turnover > CurrentTO;
TOFilt = IIf(TOTog,TOFilter,1);In order to fix the above, need to determine the number of bars in the analysis date range.
LeeDanelloParticipantyep, You only need to reference the unadjusted close if you have a price filter that you wish to have your stocks chosen from ie between $1 to $10, otherwise don’t worry about it.
LeeDanelloParticipantSaid Bitar wrote:first run backtest in Amibroker without any commissions and set the maximum number of positions to 200 (for example) and position size to 1% the aim is to get the maximum number of possible trades. then save the CSV file.I’m assuming you’re explaining this for a 2:1 leverage? So for an unleveraged account would this be 100 for 1%?
LeeDanelloParticipantScott McNab wrote:Julian Cohen wrote:My question is does it really matter?As long as you are fully aware of selection bias and it’s effects, which most traders are not, and as long as your MCS testing has narrowed down the mins and max averages to something that you are comfortable with, and as long as your trading system stays within those averages, does it make a difference if the number of trades taken is 100% of signals or 80% of signals. If it is 80% you know that you will still have a system that can perform robustly, but at the lower levels of your MCS testing, which in reality is the best you should hope for.
Am I way off on my thinking?
+1…..wouldlove to know potential impact..is may depend on the system …maybe a trend following system which relies on a few big winners to offset multiple losers would be more susceptible than a high frequency intra-day system ?
The larger the selection bias then the larger the spread in your MCS. If you’re happy with the lower end of your MCS, then selction bias isn’t an issue. I did some testing and found that in order to remove most of the selection bias or approach the stats that Nick posted, I should be trading 20 positions instead of 10 so to get the maximum bang for buck out of my system that means using margin. 10 positions allows 75% of signals taken, whereas 20 gives me about 90%. That’s a bit of a no brainer.
LeeDanelloParticipantI actually hit the orange maintenance icon at the bottom RH corner of the charting screen and it updated while the program was open.
LeeDanelloParticipantJust figured it out
See bottom right -
AuthorPosts