Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Optimization Fitnesses: Trading Days
Collapse
X
-
Optimization Fitnesses: Trading Days
I'm working on a custom optimization fitness script and need the number of trading days that the "Time frame" spans. So, how is the number of trading days best obtained (that I can use in this script) ?Tags: None
-
Hello spottysallrite,
The strategy.SystemPerformance would have the trades. You could look at the first index entry datetime and compare this with the last index exit datetime.
Code:Print((strategy.SystemPerformance.AllTrades[0].Entry.Time - strategy.SystemPerformance.AllTrades[strategy.SystemPerformance.AllTrades.Count - 1].Exit.Time).Days);
Chelsea B.NinjaTrader Customer Service
-
mmm. Doesn't that formula assume that there are trades on the first day as well as the last day?
I tried dividing TradesCount by TradesPerDay, but it looks like the calc for TradesPerDay is off. Could you look into that as well?
Seems like that since the "Summary" in the Strategy Analyzer has the Start date and the End date that this would be easily obtained. No ?
Comment
-
-
Hello spottysallrite,
This would be undocumented, but try using the strategy.Bars.FromDate, strategy.Bars.ToDate.
Hello, I want to build an optimization fitness that uses Start Date and End Date that is set manually in Strategy Analyzer's settings. I want to use that and not Minimum Trade Date and Maximum Trade Date, because for strategies with low trade numbers, there may not be enough data to get correct Start and End date. So howChelsea B.NinjaTrader Customer Service
Comment
-
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by CarlTrading, 03-31-2026, 09:41 PM
|
1 response
80 views
1 like
|
Last Post
|
||
|
Started by CarlTrading, 04-01-2026, 02:41 AM
|
0 responses
41 views
0 likes
|
Last Post
by CarlTrading
04-01-2026, 02:41 AM
|
||
|
Started by CaptainJack, 03-31-2026, 11:44 PM
|
0 responses
64 views
2 likes
|
Last Post
by CaptainJack
03-31-2026, 11:44 PM
|
||
|
Started by CarlTrading, 03-30-2026, 11:51 AM
|
0 responses
66 views
0 likes
|
Last Post
by CarlTrading
03-30-2026, 11:51 AM
|
||
|
Started by CarlTrading, 03-30-2026, 11:48 AM
|
0 responses
54 views
0 likes
|
Last Post
by CarlTrading
03-30-2026, 11:48 AM
|
Comment