In this backtest I added start and stop dates to track_orders() because I think the logging window would otherwise reach its hard limit, and chose to hone in on the date ranges 2007-05-07 to 2008-02-13 and 2010-04-26 to 2010-11-15, they looked sort of interesting in the custom chart. The code for adjusting them looks like this:
# track_orders() dates to start or stop logging.
# This is to target a date range and not overwhelm the logging window.
# These lists can be empty like []
context.dates = {
'active': 0,
'start' : ['2007-05-07', '2010-04-26'],
'stop' : ['2008-02-13', '2010-11-15']
}
I missed earlier calls for my attention unfortunately.
In the output there are tons of unfilled orders for awhile, maybe part of the problem if that's an unusual number of them.
The first number in that line is supposed to be the trading minute (1 - 390) and was working in another algo earlier today, 630 is out of range so I don't know what's up with that. If someone wants to fix it, be my guest please. Edit: That's only in daily mode and the problem is taken care of with the latest update at Track Orders.
2006-09-29trade:135INFO1.00215015566
2006-09-29getCarried:196INFONumStcks, Exp. DivYd, Vy 55 6.31 0.30
2006-12-29trade:135INFO1.03043371783
2006-12-29getCarried:196INFONumStcks, Exp. DivYd, Vy 53 6.68 0.27
2007-03-30trade:135INFO1.03275110091
2007-03-30getCarried:196INFONumStcks, Exp. DivYd, Vy 49 5.73 0.28
2007-05-07track_orders:73INFO 630 Sell -242 CRE at 44.74 cash -72739
2007-05-07track_orders:73INFO 630 Sell -242 CRE at 44.74 cash -72739
2007-05-07track_orders:73INFO 630 Sell -242 CRE at 44.74 cash -72739
2007-05-07track_orders:73INFO 630 Sell -10 GTM at 42.0 cash -72739
2007-05-07track_orders:73INFO 630 Sell -225 GTM at 42.0 cash -72739
2007-05-07track_orders:73INFO 630 Sell -225 GTM at 42.0 cash -72739
2007-05-07track_orders:73INFO 630 Sell -225 GTM at 42.0 cash -72739
2007-05-07track_orders:73INFO 630 Sell -225 GTM at 42.0 cash -72739
2007-05-07track_orders:73INFO 630 Sell -225 GTM at 42.0 cash -72739
2007-05-07track_orders:73INFO 630 Sell -225 GTM at 42.0 cash -72739
2007-05-07track_orders:73INFO 630 Sell -225 GTM at 42.0 cash -72739
2007-05-07track_orders:73INFO 630 Sell -225 GTM at 42.0 cash -72739
2007-05-07track_orders:73INFO 630 Sell -225 GTM at 42.0 cash -72739
2007-05-07track_orders:73INFO 630 Sell -225 GTM at 42.0 cash -72739
2007-05-07track_orders:73INFO 630 Sell -348 TLD at 35.37 cash -72739
2007-05-07track_orders:73INFO 630 Sell -348 TLD at 35.37 cash -72739
2007-05-07track_orders:73INFO 630 Sell -348 TLD at 35.37 cash -72739
2007-05-07track_orders:73INFO 630 Sell -348 TLD at 35.37 cash -72739
2007-05-07track_orders:73INFO 630 Sell -1098 GEMP at 3.38 cash -72739
2007-05-07track_orders:73INFO 630 Sell -2022 PA at 24.99 cash -72739
2007-05-07track_orders:73INFO 630 Sell -2022 PA at 24.99 cash -72739
2007-05-07track_orders:73INFO 630 Sell -2022 PA at 24.99 cash -72739
2007-05-08track_orders:49INFO 630 GTM -225 unfilled
2007-05-08track_orders:49INFO 630 CRE -242 unfilled
2007-05-08track_orders:49INFO 630 GTM -225 unfilled
2007-05-08track_orders:49INFO 630 TLD -348 unfilled
2007-05-08null:nullWARNLogging limit exceeded; some messages discarded
2007-05-16track_orders:49INFO 630 GTM -225 unfilled
2007-05-16track_orders:49INFO 630 CRE -242 unfilled
2007-05-16track_orders:49INFO 630 GTM -225 unfilled
2007-05-16track_orders:49INFO 630 TLD -348 unfilled
2007-05-16track_orders:49INFO 630 GTM -225 unfilled
2007-05-16track_orders:49INFO 630 GEMP -1098 unfilled
2007-05-16track_orders:49INFO 630 GTM -225 unfilled
2007-05-16track_orders:49INFO 630 GTM -225 unfilled
2007-05-16track_orders:49INFO 630 GTM -225 unfilled
2007-05-16track_orders:49INFO 630 GTM -225 unfilled
2007-05-16track_orders:49INFO 630 TLD -348 unfilled
2007-05-16track_orders:49INFO 630 CRE -242 unfilled
2007-05-16track_orders:49INFO 630 PA -2022 unfilled
My previous message in this thread had said ~165%, that's PvR in the chart. Here, it is 132%. There had been an upgrade and/or I introduced a bug.
I had mentioned a high in 2008, it's a bit different now.
Although the code is undoubtedly onto something that is useful and affects us all, it has been evolving. I'm actually doubting the specifics in the calculations and would love to have extra eyes on it from some of you and the fine folks at Quantopian. Maybe instead of RiskHi, the PvR value should be purely based on max_leverage. Then the shorts business could be dropped. The context.account.leverage value I think is definitely trustworthy (the only problem with it is when we try to use it in record() for a minute-level backtest and are missing 389 out of the 390 minutes of the trading day), so basing everything on that would simplify.
In the custom chart you can click legend items to toggle them off/on and bring the ones you're interested in, into range. In doing that, turning the large value items off and focusing on MaxLv, I see there is a jump early in 2003 so it might be handy to reset track_orders() to a date range there, or just remove the dates, make those empty lists. The logging window maybe would hit its limit however it doesn't matter if you are working just a few months in to the run because you might even have the end date set real early.