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
How to customize color, dash style, plot style, and width on a custom indicator?
Collapse
X
-
How to customize color, dash style, plot style, and width on a custom indicator?
When you add a plot at a custom indicator there is automatically a configuration for color, dash style, plot style, and width. How can I get such behaviour using a custom indicator? I would like to add that configuration to a dynamic plot that I need to create. I was able to set fields individually but not grouped like it is in the plot.Tags: None
-
https://ninjatrader.com/support/help...ml?addplot.htm
https://ninjatrader.com/support/help...tsconfigurable .htm
private Brush iBrushPlotUp=Brushes.Green;
OnBarUpdate()
PlotBrushes[0][0].= iBrushPlotUp=Brushes.Green;(depends on your condition.
further adjust Color in #region Properties
[Browsable(false)]
[XmlIgnore()]
Public x<.> y
{
get; set;
}
Plot Brushes/Plot. has more info for customizing your own color settings.(Indicator which dynamically adds a plot in State.Configure) heading.
Last edited by Emma1; 06-30-2022, 06:54 AM.
-
Hello diegobernardes,
Thanks for your post.
You could specify a brush color, dash style, width, and plot style by using the AddPlot() syntax that allows you to pass in a Stroke argument. The Stroke allows you to specify the brush color, dash style, and width of the plot. when calling AddPlot().
AddPlot(Stroke stroke, PlotStyle plotStyle, string name)
See the attached example script demonstrating this.
Also, see this help guide page for more information and sample code.
AddPlot(): https://ninjatrader.com/support/help...t8/addplot.htm
Stroke: https://ninjatrader.com/support/help...roke_class.htm
Let me know if I may assist further.
Attached FilesBrandon H.NinjaTrader Customer Service
Comment
-
Thanks for the reply folks. What I'm trying to do is to expose that config to the user via the parameters. I could create 4 different parameters but I would like to do something similar to the Order Flow Cumulative Delta configuration. It's a single parameter called `Candle body outline` when it's expanded it shows the Color, Dash style, Opacity, and Width. How can I add that kind of configuration to the parameters?
Comment
-
Hello diegobernardes,
Thanks for your note.
When you add a plot to a script by calling AddPlot() and define the public property for that plot, you will see a section at the bottom of the Indicator's Properties section that allows you to change the color, dash style, plot style, and width properties.
For example, import the example script I shared in post #3 by going to Tools > Import > NinjaScript AddOn. After importing the script, open a New > Chart window, add the example indicator to the chart, and at the bottom of the Properties section of the Indicators window, click the down arrow next to 'Plots', and click the down arrow next to 'Plot1' to see these options.
See the attached screenshot. Also, open the example script in a New > NinjaScript Editor window and note the 'Properties' section of code.
Let us know if we may assist further.Brandon H.NinjaTrader Customer Service
Comment
-
I got it, but what is the code that I can add to the property settings at the NinjaScript to have that feature? Forget the plot, I just want to have that exact behaviour as the screenshot I just sent.
Code:[NinjaScriptProperty] [Display(Name = "Color") public Brush Color { get { return color; } set { color = value; } }
Comment
-
Hello diegobernardes,
Thanks for your note.
Create expandable objects for properties would be unsupported. Using expandable objects for properties doesn't apply all the same logic to the sub-properties in the expandable object. For example, some of the UI items like tooltips would not work. The properties would also not work in the Strategy Analyzer.
That said, it would be best practices to group the properties together in Categories.
See this help guide page for more information and sample code: https://ninjatrader.com/support/help...rattribute.htm
Let me know if I may further assist.Brandon H.NinjaTrader Customer Service
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by hazylizard, Today, 08:38 AM
|
1 response
8 views
0 likes
|
Last Post Today, 08:53 AM | ||
Started by geddyisodin, Today, 05:20 AM
|
2 responses
17 views
0 likes
|
Last Post
by geddyisodin
Today, 08:44 AM
|
||
Started by Max238, Today, 01:28 AM
|
5 responses
45 views
0 likes
|
Last Post
by Max238
Today, 08:30 AM
|
||
Started by giulyko00, Yesterday, 12:03 PM
|
3 responses
13 views
0 likes
|
Last Post Today, 08:26 AM | ||
Started by habeebft, Today, 07:27 AM
|
1 response
16 views
0 likes
|
Last Post Today, 08:08 AM |
Comment