Announcement
Collapse
Looking for a User App or Add-On built by the NinjaTrader community?
Visit NinjaTrader EcoSystem and our free User App Share!
Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less
Partner 728x90
Collapse
NinjaTrader
Multi-Color plot using PlotStyle.Bar
Collapse
X
-
Multi-Color plot using PlotStyle.Bar
I am new to NinjaTrader and have made a simple SMA indicator using PlotStyle.Line that changes color based on it rising or falling. When using PlotStyle.Bar I can't get the color to change. How do you implement a multi-color bar?Tags: None
-
Hello spongeb0b,
You can use PlotBrushes to color bar type plots. The sample from the help guide works for that type. This is also a simple way to demonstrate that just using the close price:
Code:if (IsRising(Close)) PlotBrushes[0][0] = Brushes.Blue; else if (IsFalling(Close)) PlotBrushes[0][0] = Brushes.Red; else PlotBrushes[0][0] = Brushes.Yellow;
JesseNinjaTrader Customer Service
-
Jesse, thank you for your response. I realized after reading my question again that I wasn't very clear about what I was asking. If you think of a line plot as a single contiguous line then the example code you gave changes it's color back and forth. In other words that single line can take on 3 different colors. I want to do the same thing for a single bar when the style is PlotStyle.Bar. So for example a single bar could take on 3 different colors. I am using OnEachTick and setting values and switching colors intrabar. What I'm noticing is that when I set a value for the plot a.k.a. bar and switch colors it just re-paints the entire bar with the last color set. If I set the bar to 25 and color it red, then set the bar to 50 and color it green, and set it to 75 and color it yellow, I want the same bar to show all 3 colors at the values they were set.
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by cre8able, Yesterday, 01:16 PM
|
3 responses
11 views
0 likes
|
Last Post
by cre8able
Today, 08:28 AM
|
||
Started by ChartTourist, Today, 08:22 AM
|
0 responses
4 views
0 likes
|
Last Post
by ChartTourist
Today, 08:22 AM
|
||
Started by LiamTwine, Today, 08:10 AM
|
0 responses
2 views
0 likes
|
Last Post
by LiamTwine
Today, 08:10 AM
|
||
Started by Balage0922, Today, 07:38 AM
|
0 responses
5 views
0 likes
|
Last Post
by Balage0922
Today, 07:38 AM
|
||
Started by JoMoon2024, Today, 06:56 AM
|
0 responses
6 views
0 likes
|
Last Post
by JoMoon2024
Today, 06:56 AM
|
Comment