The Horizontal Line is what I have been using. Because I can't get the bars in the Indicator panel to print red if below 5 seconds then I use the Horizontal Line set to 5 seconds. If the bar is below the Horizontal Line then the market is moving fast. The Horizontal Line is an alternative to telling me how fast the market is moving. It's just a frame of reference.
Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
NT8 Bar Times
Collapse
X
-
Chelsea all I was trying to do is, using the original Indicator set to "seconds," if the price bar, say a NQ 30 Range bar, from open to close, was less than 5 seconds, to put in a red bar in the Indicator panel. Otherwise it would put in a SeaGreen bar (I reset the color from his). That would tell me the market was moving very fast and to stand aside. I was using it as a Pace of the Tape indicator.
The Horizontal Line is what I have been using. Because I can't get the bars in the Indicator panel to print red if below 5 seconds then I use the Horizontal Line set to 5 seconds. If the bar is below the Horizontal Line then the market is moving fast. The Horizontal Line is an alternative to telling me how fast the market is moving. It's just a frame of reference.
-
Hello RJBen,
"to put in a red bar in the Indicator panel."
Is the indicator in a panel that is separate from the price bars panel or are these in the same panel?
This sounds like you want the price bar to be red, or could mean you want to add a bar plot style plot for a vertical bar that is red, or you could mean a rectangle which could be spread horizontally across several bars.
If you want to draw a single horizontal line call:
if (BarTimes(CustomBsEnumNamespace.TimeSelector.Secon ds).BarTime[0] > 5)
{
Draw.HorizontalLine(this, "MyHorizontalLine", Close[0], Brushes.Red);
}
The VOL indicator included with NinjaTrader is a bar style plot which can look at as a reference to how this renders.
If you are wanting a vertical bar style plot add to OnStateChange() in the State.SetDefaults logic block:
AddPlot(new Stroke(Brushes.Red), PlotStyle.Bar, "MyPlot");
In OnBarUpdate() call:
if (BarTimes(CustomBsEnumNamespace.TimeSelector.Secon ds).BarTime[0] > 5)
{
Values[0] = 1;
}Chelsea B.NinjaTrader Customer Service
Comment
-
No Chelsea. This indicator plots a bar down in it's Indicator panel. The indicator's bar color, as it is written, is constant. I wanted to add a condition to the seconds timeframe- If the bar is less than 5 seconds, then change the color of the bar, in the Indicator panel to red. I want to change the Indicator's bar color to red.
Comment
-
Hello RJBen,
What are you referring to as "The indicator's bar color"?
Can you provide a screenshot to show what you are referring to?
"If the bar is less than 5 seconds, then change the color of the bar"
Just to confirm, you are actually talking about the price bar color?
"If the bar is less than 5 seconds, then change the color of the bar, in the Indicator panel to red."
If the indicator is in a separate panel, then the price bars will not be in the indicator panel. You can set the price bar color to red, but this would be in the price bar panel.
Are you 100% certain that you are not referring to an indicator plot or a drawing object?
Please let me know what you are referring to.Chelsea B.NinjaTrader Customer Service
Comment
-
-
Hello RJBen,
Thank you for your screenshot.
The screenshot is showing vertical bar plot style plots.
If you want to set the color of a plot bar assign PlotBrushes[0] a brush value.
Code:if (BarTimes(CustomBsEnumNamespace.TimeSelector.Seconds).BarTime[0] > 5) { PlotBrushes[0][0] = Brushes.Red; }Chelsea B.NinjaTrader Customer Service
Comment
-
Chelsea we've done a complete 360. We are back exactly where we started. See post #3. Same errors. Same issues.
Where, exactly, does this code snippet go? Every place I try to put it brings up the same error message. I removed the Indicator with all my changes. I Imported it back in. I didn't make any changes to it. It is exactly as Paul wrote it. So where, exactly does this code go? Because for me it keeps bringing up the exact same errors regardless of where I add this code snippet.
I put it in 6 different places. Every place I put it causes an error.-I can't implicitly convert it to a bool. Every place I put it I get an error.
This will be the last time. After this I'll just forget it.
Comment
-
Hello RJBen,
May I confirm you imported the corrected script in post # 13?
I'm finding this suggested code compiles and works without any issues.
Note, post # 20 was the first time you actually showed you wanted to add a plot, set the value of the plot, and set the color of a plot.
Previously you were stating you wanted to change the bar color. Also you stated in post # 7 you wanted a horizontal line.
In post # 15 I attempted to get clarification on what you are trying to do using the proper terms and asked if you were trying to add a plot and set the plot color. I've provided a link on how to add a plot and set the value and provided sample code in post # 17.
If you are not understanding do not wish to create the script yourself and would like to hire someone to code your script for you, you can also contact a professional NinjaScript Consultant who would be eager to create or modify this script at your request or assist you with your script.
You can search our extensive library of NinjaScript consultants through the link below. Simply enter a consultant name or search by using our filter categories. Once you have identified your consultants of choice, please visit each consultant's site for more information or contact them directly to learn more!
Programming Services - https://ninjatraderecosystem.com/sea...mming-services
Educators - https://ninjatraderecosystem.com/sea...ures=education
You can locate the contact information for the consultants on their direct websites for any additional questions you may have. Since these consultants are third party services for NinjaTrader all pricing and support information will need to be obtained through the consultant.
This NinjaTrader Ecosystem website is for educational and informational purposes only and should not be considered a solicitation to buy or sell a futures contract or make any other type of investment decision. The companies and services listed on this website are not to be considered a recommendation and it is the reader's responsibility to evaluate any product, service, or company. NinjaTrader Ecosystem LLC is not responsible for the accuracy or content of any product, service or company linked to on this website.Chelsea B.NinjaTrader Customer Service
Comment
-
Nope. No dice. It's okay. We'll move on. I think we both wasted enough time on this.
The Output Window says this, "Indicator 'RJBenBarTimesTest': Error on calling 'OnBarUpdate' method on bar 671: Index (zero based) must be greater than or equal to zero and less than the size of the argument list."Last edited by RJBen; 02-05-2025, 12:18 PM.
Comment
-
Got it. Finally. Had to change the code a little.
if (barTimesIndy.BarTime[0] < 5) // changed the sign to "Less than"
{
Print(string.Format("{0} | barTimesIndy.BarTime[0]: {0} is less than 5, setting bar brush to red", Time[0])); // changed "{1} is greater than 5," to "{0} is less than 5,"
PlotBrushes[0][0] = Brushes.Red;
}
Now it works!Last edited by RJBen; 02-05-2025, 07:20 PM.
Comment
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by Geovanny Suaza, 02-11-2026, 06:32 PM
|
0 responses
557 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
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
545 views
1 like
|
Last Post
|
||
|
Started by RFrosty, 01-28-2026, 06:49 PM
|
0 responses
547 views
1 like
|
Last Post
by RFrosty
01-28-2026, 06:49 PM
|

Comment