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 NullPointStrategies, Today, 05:17 AM
|
0 responses
52 views
0 likes
|
Last Post
|
||
|
Started by argusthome, 03-08-2026, 10:06 AM
|
0 responses
130 views
0 likes
|
Last Post
by argusthome
03-08-2026, 10:06 AM
|
||
|
Started by NabilKhattabi, 03-06-2026, 11:18 AM
|
0 responses
70 views
0 likes
|
Last Post
|
||
|
Started by Deep42, 03-06-2026, 12:28 AM
|
0 responses
43 views
0 likes
|
Last Post
by Deep42
03-06-2026, 12:28 AM
|
||
|
Started by TheRealMorford, 03-05-2026, 06:15 PM
|
0 responses
48 views
0 likes
|
Last Post
|
Comment