Forums › Trading System Mentor Course Community › Performance Metrics & Brag Mat › how to calculate max wait days?
- This topic is empty.
-
AuthorPosts
-
June 22, 2016 at 4:28 am #101400AnonymousInactive
probably sounds like a silly question but… i still have not been able to do this in excel. how to calculate max wait days?
example is in the course notes
June 22, 2016 at 5:41 am #104394TrentRothallParticipantThis is how i do it Darryl, Nick pointed me in the right direction a while ago – i think its right, might not be as accurate on long term models
1. run a backtest then sort by entry dates – paste into excel
2. add blank columns after the profit columns – insert the following formula and fill down
3. then add the following formulas in the next columns
then you can graph it, but it will be in Number of trades not days – i just went through and used the formula = DAYS() to manually look at the length of the longer ones in days.
Someone might have a better solution i couldn’t work out how to graph in days
June 22, 2016 at 5:57 am #104395Nick RadgeKeymastertry this:
June 22, 2016 at 6:30 am #104400AnonymousInactiveNick Radge wrote:try this:shall do!
June 22, 2016 at 6:33 am #104399AnonymousInactiveTrent Rothall wrote:This is how i do it Darryl, Nick pointed me in the right direction a while ago – i think its right, might not be as accurate on long term models1. run a backtest then sort by entry dates – paste into excel
2. add blank columns after the profit columns – insert the following formula and fill down
3. then add the following formulas in the next columns
then you can graph it, but it will be in Number of trades not days – i just went through and used the formula = DAYS() to manually look at the length of the longer ones in days.
Someone might have a better solution i couldn’t work out how to graph in days
too easy! :blink: :silly:
June 22, 2016 at 7:37 am #104401TrentRothallParticipantDarryl Vink wrote:too easy! :blink: :silly:How did you go?
June 22, 2016 at 10:18 am #104404AnonymousInactiveTrent Rothall wrote:Darryl Vink wrote:too easy! :blink: :silly:How did you go?
all good trent. max wait from my MR system backtested from 01/01/2000 – 31/12/2015 was 209 days from 09/03/2004 till 04/10/2004:
June 22, 2016 at 4:40 pm #104420SaidBitarMembertwo options
the easy one and the other one
the easy one is :
Code:SetCustomBacktestProc(“”);
if (Status(“action”) == actionPortfolio)
{
bo = GetBacktesterObject();
bo.Backtest();
Eqty = Foreign(“~~~Equity”, “C”);
MaxEq = Highest(Eqty);
FlatEq = BarsSince(MaxEq > Ref(MaxEq,-1));
MaxFlat = LastValue(Highest(FlatEq));
bo.AddCustomMetric(“Max Flat Eq Bars”, MaxFlat);
}it will return the number of bars (calendar days) if the database is EOD.
the other option is the excel option and they will give the same results
June 22, 2016 at 10:28 pm #104421JulianCohenParticipantSaid Bitar wrote:it will return the number of bars (calendar days) if the database is EOD.the other option is the excel option and they will give the same results
Where do you place this in the code Said? Does it matter where?
June 22, 2016 at 11:56 pm #104423LeeDanelloParticipantJulian Cohen wrote:Said Bitar wrote:it will return the number of bars (calendar days) if the database is EOD.the other option is the excel option and they will give the same results
Where do you place this in the code Said? Does it matter where?
Place it at the end of your system code.
It comes up as the last line in your back test report
June 23, 2016 at 1:19 am #104422LeeDanelloParticipantSaid Bitar wrote:two optionsthe easy one and the other one
the easy one is :
Code:SetCustomBacktestProc(“”);
if (Status(“action”) == actionPortfolio)
{
bo = GetBacktesterObject();
bo.Backtest();
Eqty = Foreign(“~~~Equity”, “C”);
MaxEq = Highest(Eqty);
FlatEq = BarsSince(MaxEq > Ref(MaxEq,-1));
MaxFlat = LastValue(Highest(FlatEq));
bo.AddCustomMetric(“Max Flat Eq Bars”, MaxFlat);
}it will return the number of bars (calendar days) if the database is EOD.
the other option is the excel option and they will give the same results
I checked this on my weekly system so to get the number of days I multiplied MaxFlat by 5.
Actually I seem to get different answers between Excel and the code by Said,. I tried it on a daily system. I also checked it by plotting the Equity ticker in Amibroker and even though that is based on the closed equity it aligns with the Excel method, By plotting the ~~~Equity ticker gives you a good visual.
June 23, 2016 at 2:04 am #104425TrentRothallParticipantIt would be trading days wouldn’t it not calendar days, is that right?
June 23, 2016 at 5:51 am #104427Stephen JamesMemberThe code returns trading bars so there should be a small variance between it and the spreadsheet method. The variance would be any weekends included in the spreadsheet calculation from date to date of the longest period.
June 23, 2016 at 6:22 am #104396TrentRothallParticipantThanks Craig – a handy piece of code Said
June 23, 2016 at 8:37 am #104428LeeDanelloParticipantCraig Fisher wrote:The code returns trading bars so there should be a small variance between it and the spreadsheet method. The variance would be any weekends included in the spreadsheet calculation from date to date of the longest period.It should be more accurate than the spreadsheet but I had quite a bit of variance. Has anyone compared the numbers?
-
AuthorPosts
- You must be logged in to reply to this topic.