Home › Forums › Trading System Mentor Course Community › AmiBroker Coding and AFL › Rolling Window Analysis
- This topic is empty.
-
AuthorPosts
-
February 6, 2017 at 6:12 am #101531JulianCohenParticipant
I’m trying to run a rolling window analysis on a daily basis, but I noticed that it is executing more than 40 trades in a day.
Have I set it up incorrectly?
February 6, 2017 at 7:23 am #106149TrentRothallParticipantI would have thought that should work, but 40 trades x $5000 you only need 50% margin with $100,000 account…. Might help it
February 6, 2017 at 7:29 am #106150JulianCohenParticipantTrent Rothall wrote:I would have thought that should work, but 40 trades x $5000 you only need 50% margin with $100,000 account…. Might help itI’m running an MOC which has 4 times margin.
It seems to be taking every trade available for the day and not cutting off at 40
February 6, 2017 at 8:08 am #106151TrentRothallParticipantBut you are starting with $100,000 account. 40*$5000 = $200,000 that’s 2x margin
But i would hve thought stating 40 positions should cut it off. Maybe check that code…
Or have i missed something??
February 6, 2017 at 8:47 am #106154JulianCohenParticipantI just changed the starting amount to 500K
Same problem….Might have to wait for Craig to come back
February 6, 2017 at 8:48 am #106156TrentRothallParticipantchange it to 50k
February 6, 2017 at 9:22 am #106157JulianCohenParticipantSame
We’re both missing something ha ha
February 6, 2017 at 9:33 am #106158SaidBitarMemberif you specify that the max open positions as 40 and you have enough cash for it then it should give you maximum of 40.
February 6, 2017 at 9:38 am #106159SaidBitarMemberdid you set the number of runs to 1 in the MCs
February 6, 2017 at 10:43 am #106161JulianCohenParticipantYes I set the MCS to 1
here’s the code I’m using:
Code://=====================================================================
//Backtesting
//=====================================================================
SetTradeDelays(0,0,0,0);
SetOption(“UsePrevBarEquityForPosSizing”,True); //Use equity available on setup day when order is placed
Capital = Param(“Initial Equity $”,100000,1000,10000000,100);
SetOption(“InitialEquity”,Capital);
MaxPos = Param(“Maximum Position Size”,40,5,1000,1);
SetOption(“MaxOpenPositions”,MaxPos);
SetOption(“AllowSameBarExit”,True);
SetOption(“AllowPositionShrinking”,False); //default off
SetOption(“InterestRate”,0); //default 0
SetOption(“MinShares”,1); //minimum 1
SetOption(“MinPosValue”,1); //minimum 1
ActMarg = Param(“Set Margin”,25,50,100,25);
SetOption(“AccountMargin”,ActMarg);
PositionScore = mtRandom();
//———————————————————————
“”;
“Position Sizing Method”;
PosSizeMethod = ParamList(“Position Sizing Method:”,”|Fixed $ Position Size|Fixed % of Portfolio Equity”,2);//risk calculations
//Fixed $ Position Size
FDAmount = Param(“Fixed $ Position Size”,5000,100,100000,100);//Fixed % of Portfolio Equity
FPAmount = Param(“Fixed % of Portfolio Equity”,10,0.1,100,1);if (PosSizeMethod == “Fixed $ Position Size”) SetPositionSize(FDAmount,spsValue);
if (PosSizeMethod == “Fixed % of Portfolio Equity”) SetPositionSize(FPAmount,spsPercentOfEquity);
//=====================================================================
_SECTION_END();//n-month rolling returns
run = Optimize(“run”, 1, 1, 1, 1);You can see this is a daily walk forward and the number of trades is over 40.
February 6, 2017 at 10:48 am #106162JulianCohenParticipantMaybe you can’t see the report.
I hate this bloody thing sometimes!
February 6, 2017 at 11:22 am #106163SaidBitarMemberyes everything looks correct and it is strange why you are having more positions
February 6, 2017 at 11:39 am #106164SaidBitarMemberI think i found the problem, try to put the end date same as the start date
because now you are testing over two days
3/01/2011 and 4/01/2011so try to put both of them the same
February 6, 2017 at 12:05 pm #106165JulianCohenParticipantYou’re a bloody genius Said.
I’ve said it a hundred times and I’m sure I’ll say it again. Thanks a lot!!!
February 6, 2017 at 2:39 pm #106166SaidBitarMemberhahaha glad it worked
-
AuthorPosts
- You must be logged in to reply to this topic.