Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
BarsType Trim & Merge
Collapse
X
-
Hello aslane,
These are undocumented so I cannot provide any details about these.
From my understanding these are not NinjaScript tools intended for NinjaScript programmers to use.
This thread will remain open for any community members that are using unsupported manipulations of these properties that would like to share.Chelsea B.NinjaTrader Customer Service
-
Hello aslane,
To prevent interfering with NinjaTrader create your own variables with unique names, that do not use any names that are already used in the BarsType namespace or in the script class.
NinjaTrader does use these functions behind the scenes for string manipulation.Chelsea B.NinjaTrader Customer Service
Comment
-
When loading a chart with data via a bars type, typically more data is requested than is actually necessary. For example, using the SecondsBarsType with 30sec period and requesting just 1 day of data actually requests 3 days of data.
For example, requesting 1 day of data on the 14 Feb, the data returned starts on 11 Feb session open:
However, when the data transitions from historical to real-time, TrimStart and TrimEnd are called with numBars = to the actual number of requested bars:
Notice the bars.Count and barsSeries.Count drops from 6208 to 3464.
Having TrimStart and TrimEnd defined as virtual methods allows any custom data structures to be trimmed to match trimmed bars/bars series. For example the Volumes property on the VolumetricBarsType which is decalred as a VolumetricData[] array. Without this, the Volumes property would contain more elements than bars and the data would be 'miss-aligned'.
Use TrimStart / TrimEnd in you own custom bar types to keep your own custom data structures aligned with the count of bars / bars series.
It's still a bit unclear to me as to why there's a separate TrimStart and TrimEnd (instead of just Trim) but they do get called with different numBars values, so be sure to trim your custom data structures in both.Last edited by tcdouglas; 03-05-2025, 02:56 AM.
Comment
-
Hello tcdouglas,
NinjaTrader automatically downloads data for the full day of the previous session prior to the first bar of the data request.
The data is then distributed to any subscribers.
Unfortunately, I cannot provide insight into the undocumented and unsupported internal properties.Chelsea B.NinjaTrader Customer Service
Comment
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by Geovanny Suaza, 02-11-2026, 06:32 PM
|
0 responses
553 views
0 likes
|
Last Post
|
||
|
Started by Geovanny Suaza, 02-11-2026, 05:51 PM
|
0 responses
324 views
1 like
|
Last Post
|
||
|
Started by Mindset, 02-09-2026, 11:44 AM
|
0 responses
100 views
0 likes
|
Last Post
by Mindset
02-09-2026, 11:44 AM
|
||
|
Started by Geovanny Suaza, 02-02-2026, 12:30 PM
|
0 responses
543 views
1 like
|
Last Post
|
||
|
Started by RFrosty, 01-28-2026, 06:49 PM
|
0 responses
546 views
1 like
|
Last Post
by RFrosty
01-28-2026, 06:49 PM
|

Comment