GT
Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Strategy Indicator
Collapse
X
-
Strategy Indicator
I have an indicator that plots a separate bar color depending on the indicators output of either +1, 0 or -1. When I add this indicator for the primary bar series in a multi-timeframe strategy it shows up correctly but when I add it to the secondary timeframe it does not plot the colors. How do I change this so that it plots the colors based on the indicator values in the multi-timeframe strategy? Thanks!
GTTags: None
-
Thank you for another quick response!
Currently I have a 30 minute chart. In a strategy I add indicator1 that plots a green bar if the output is +1, a yellow bar if the output is 0 and a red bar if the output is -1. I the add the following in the initialize section:
Add(PeriodType.Minute, 120);
Add(PeriodType.Minute, 240);
Add(StrategyPlot(0));
Add(StrategyPlot(1));
StrategyPlot(0).PanelUI = 3;
StrategyPlot(1).PanelUI = 4;
Then in the OnBarsUpdate section I use:
StrategyPlot(0).Value.Set(Indicator1(BarsArray[1], false, 50)[0]);
StrategyPlot(1).Value.Set(Indicator1(BarsArray[2], false, 50)[0]);
This plots the correct value of the second and third bar series (i.e. +1,0,-1) but only plots a line at the value and does not update the color based on the indicator1 value.
1) I assume I need to specify in my code to plot as a bar instead of a line, where and how do I do this?
2) Do I need to go through the plot section of the code just as in the indicator and state if +1 then barColor = green? Shouldn't just adding and calling the indicator automatically do this for me? Other suggestions on how to update this?
Thanks!
GT
Comment
-
1. You could try something like StrategyPlot(0).Plots[0].PlotStyle = PlotStyle.Bar;
2. If you want multiple colors you need to actually have multiple plots in the indicator itself and use the multi-colored indicators technique demonstrated here: http://www.ninjatrader-support2.com/...ead.php?t=3227Josh P.NinjaTrader Customer Service
Comment
-
Thank you again for the quick response. I do currently have multi colored plots in the indicator. When I add the indicator into the multi timeframe strategy the primary bars indicator works correctly but the secondary bars indicators do not. The indicator itself does work correctly when added to the primary bar chart. I will look at your suggestion for #1. Thanks!
GT
Comment
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by charlesugo_1, 05-26-2026, 05:03 PM
|
0 responses
51 views
0 likes
|
Last Post
by charlesugo_1
05-26-2026, 05:03 PM
|
||
|
Started by DannyP96, 05-18-2026, 02:38 PM
|
1 response
142 views
0 likes
|
Last Post
|
||
|
Started by CarlTrading, 05-11-2026, 05:56 AM
|
0 responses
160 views
0 likes
|
Last Post
by CarlTrading
05-11-2026, 05:56 AM
|
||
|
Started by CarlTrading, 05-10-2026, 08:12 PM
|
0 responses
96 views
0 likes
|
Last Post
by CarlTrading
05-10-2026, 08:12 PM
|
||
|
Started by Hwop38, 05-04-2026, 07:02 PM
|
0 responses
275 views
0 likes
|
Last Post
by Hwop38
05-04-2026, 07:02 PM
|

Comment