I trade longer term mechanical trading systems exclusively on the ASX. I rarely look at daily charts and the systems are built using weekly timeframes. The information in this site is based on actual trades in real portfolios. I don't trade using margin or any sort of leverage. I mainly use Amibroker for system testing and trade monitoring. I am not selling anything. This is just a journal to record where I have been and, just maybe, where I am going.
Friday, March 30, 2007
Limiting the number of trades per week
Using some code Shutty found on Yahoo I was able to see the impact of limiting the maximum number of trades per week. I added the code in did an optimise and exported the results to Excel to get the graph above.
For a longer term system, like the one used for this test, it is possible to limit the number of buys to one per week and still get reasonable results.
With a shorter term system limiting the number of trades per week would have a bigger impact since the system needs to trade more - see the results for a 4 week system below.
Subscribe to:
Post Comments (Atom)
5 comments:
Stevo, Could you please post a link to the code or the code itself that you used for the Limiting the number of trades per week.
Hopefully this posts ok.
// Maximum buys in a period
//-----------------------------
SetCustomBacktestProc("");
Num = Optimize("MaxBuys",4,0,9,1);
MaxBuys = Num;
if( Status("action") == actionPortfolio ) {
bo = GetBacktesterObject();
bo.PreProcess();
for( i = 0; i < BarCount; i++ ) {
cntBuys = 0;
for( sig = bo.GetFirstSignal(i); sig; sig = bo.GetNextSignal(i) ) {
if( sig.IsEntry() ) {
if( cntBuys > MaxBuys - 1 ) {
sig.PosSize = 0;
} else {
cntBuys = cntBuys + 1;
}
}
}
bo.ProcessTradeSignals( i );
}
bo.PostProcess();
}
//-----------------------------
Hi Stevo,
Could you please post the part that limits the number of signals taken per week.The code you posted if I am not mistaken only limit the number of buys on a daily basis.
I understand if you are not willing to post the entire code,if this is the case could you just give me the logic you used?
For another example of limiting the number of buys per day see the link below to a code written by Tomasz Janeczko.
http://www.mail-archive.com/amibroker@yahoogroups.com/msg19841.html
Cheers,
Since I set time frame to weekly the code above limits the number of buys in a week. I pretty much only use weekly charts.
regards
stevo
Thank you Stevo
Regards,
Mike
Post a Comment