Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Make line plot vary between dash and dot style
Collapse
X
-
Hello omololu,
Thanks for your reply.
It appears member s.Kinra has you sorted.
The screesnhot I provided shows the code that I used.
The only thing not shown was region properties, which I am posting below:
#region Properties
[Browsable(false)]
[XmlIgnore]
public Series<double> Test1
{
get { return Values[0]; }
}
[Browsable(false)]
[XmlIgnore]
public Series<double> Test2
{
get { return Values[1]; }
}
#endregion
-
Thanks s.kinra,
The SampleEmaCross is a little different. I love to have Paul's script/codes.
Omololu
Leave a comment:
-
Hello Omololu,
Here you get a sample EMA cross, it plots dash style when fast ema is above slow ema & dot style when fast ema is below slow ema. Hope it helps!
SampleEmaCross.zip
Leave a comment:
-
Hi Paul,Originally posted by NinjaTrader_PaulH View PostHello catinabag,
Thanks for your post.
With a plot, you cannot change the PlotStyle or DashStyle in the same manner as the PlotBrush.
The PlotStyle or DashStyle would be applied to the entire plot.
You may be able to accomplish your goal by using multiple plots, each set to the DashStyle of your choice. I've attached a screenshot of a quick example.
I attempted to test your "quick example" script/codes in your post above but I'm not successful. Please, could you post the full working script/codes.
Regards.
Omololu
Leave a comment:
-
Hello patricia70,
Thanks for your replies and glad forum member s.kinra was able to help.
Going forward, a simpler approach would be to use the Ninjascript indicator wizard when creating your strategy as, in the case of plots, it will create all of the structure you were missing automatically for you. The wizard can also create lines, custom data series, and various user inputs. So basically you specify the Inputs and outputs you wish, the wizard creates all the structure and then provides you with a script where you can then enter your code in the OnBarUpdate().
Please see the help guide here: https://ninjatrader.com/support/help...?ns_wizard.htm
- Likes 1
Leave a comment:
-
Hello patricia70,
Refer below link for further reading:
Leave a comment:
-
helps a bit, thank you. I need to dig further into it.Last edited by patricia70; 11-05-2020, 03:25 AM.
Leave a comment:
-
Hello patricia70,
Please refer below details:-[Browsable(false)] // this line prevents the data series from being displayed in the indicator properties dialogThis is standard syntax & if you use new indicator wizard its done automatically. Hope it helps!
[XmlIgnore()] // this line ensures that the indicator can be saved/recovered as part of a chart template
public Series<double> test // this line defines plot as double series
{ get { return Values[0]; } } // this line assigns value at current bar to series defined
Leave a comment:
-
that's it! thank you.
I hate it copying, pasting or writing code that I don't understand. I would like to understand what each line is doing. Can you point me to the right direction for a good understanding tutorial about those properties?Last edited by patricia70; 11-05-2020, 02:21 AM.
Leave a comment:
-
Hello patricia70,
Be sure to add properties for these plots as below:-If you don't add these properties then you have to use Values[0][0] / Values[1][0] for you code. Hope it helps!Code:[INDENT][I][Browsable(false)] [XmlIgnore] public Series<double> ts_lower { get { return Values[0]; } } [Browsable(false)] [XmlIgnore] public Series<double> ts_upper { get { return Values[1]; } }[/I][/INDENT]
Leave a comment:
-
I'd also like to use "your" way because of the reason you mentioned. I have substituted Test1 and Test2 accordingly. Here's my code:
Code:[...] protected override void OnStateChange() { if (State == State.SetDefaults) { Description = @"foo"; Name = "bar"; Calculate = Calculate.OnBarClose; IsOverlay = true; DisplayInDataBox = true; DrawOnPricePanel = true; DrawHorizontalGridLines = true; DrawVerticalGridLines = true; PaintPriceMarkers = true; ScaleJustification = NinjaTrader.Gui.Chart.ScaleJustification.Right; IsSuspendedWhileInactive = true; AddPlot(new Stroke (Brushes.Red, DashStyleHelper.Dash, 2), PlotStyle.Line, "ts_upper"); AddPlot(new Stroke (Brushes.Green, DashStyleHelper.Dash, 2), PlotStyle.Line, "ts_lower"); } [...] protected override void OnBarUpdate() { if (CurrentBar < 2) return; { if ( trendDir == 1 ) ts_lower[0] = Low[1]; if ( trendDir == -1 ) ts_upper[0] = High[1]; } [...]Last edited by patricia70; 11-04-2020, 03:53 PM.
Leave a comment:
-
Hello patricia70,
Thanks for your reply.
I would suggest attaching your code file for review. You may be missing the output side of the plots.
Yes, you can use Values, however, I prefer using Plot names as reading the code it becomes clear what you are using.
Leave a comment:
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by Mindset, 04-21-2026, 06:46 AM
|
0 responses
50 views
0 likes
|
Last Post
by Mindset
04-21-2026, 06:46 AM
|
||
|
Started by M4ndoo, 04-20-2026, 05:21 PM
|
0 responses
69 views
0 likes
|
Last Post
by M4ndoo
04-20-2026, 05:21 PM
|
||
|
Started by M4ndoo, 04-19-2026, 05:54 PM
|
0 responses
36 views
0 likes
|
Last Post
by M4ndoo
04-19-2026, 05:54 PM
|
||
|
Started by cmoran13, 04-16-2026, 01:02 PM
|
0 responses
97 views
0 likes
|
Last Post
by cmoran13
04-16-2026, 01:02 PM
|
||
|
Started by PaulMohn, 04-10-2026, 11:11 AM
|
0 responses
60 views
0 likes
|
Last Post
by PaulMohn
04-10-2026, 11:11 AM
|

Leave a comment: