if(BarsPeriod.BarsPeriodType.ToString() == "Minute"){
Print(BarsPeriod.BarsPeriodType.ToString())
// do stuff
}
Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Checking BarsPeriod.BarsPeriodType
Collapse
X
-
Checking BarsPeriod.BarsPeriodType
Inside of my OnRender() I only want to do stuff if the chart Periodicity is a minute based chart. Otherwise, don't do anything. Here is what I've tried:
It prints out "Minute" regardless of whether I am on a Minute, Tick or Range chart. What am I doing wrong? Please note that I have added additional 1 minute bars objects to the chart however, the doc's indicate this is checking the Primary Bars object and not any of the additional bars objects.Code: -
Hello swcooke,
I have attached a sample which will draw "Text1" at the bottom of a chart only when its a minute chart.
To test I suggest applying the indicator, and toggling between a daily series and a minute series.
Please let us know if you need further assistance.Attached FilesAlan P.NinjaTrader Customer Service
Comment
-
In your State.Configure block, add another data series like this and you'll see the issue I am having:
Then test. You'll see that your green text flashes on and off on a tick chart or range chart. Seems like BarsPeriod.BarsPeriodType is referring to the secondary data series at certain times. The docs indicate it only returns this info on the primary bars object. Thoughts?Code:AddDataSeries("XLK",BarsPeriodType.Minute,1);
Comment
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by Geovanny Suaza, 02-11-2026, 06:32 PM
|
0 responses
571 views
0 likes
|
Last Post
|
||
|
Started by Geovanny Suaza, 02-11-2026, 05:51 PM
|
0 responses
330 views
1 like
|
Last Post
|
||
|
Started by Mindset, 02-09-2026, 11:44 AM
|
0 responses
101 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
549 views
1 like
|
Last Post
|
||
|
Started by RFrosty, 01-28-2026, 06:49 PM
|
0 responses
549 views
1 like
|
Last Post
by RFrosty
01-28-2026, 06:49 PM
|

Comment