Thank you
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
Modify RSI plots
Collapse
X
-
Hello guidoisot,
Thank you for your post.
You could achieve this by utilizing Draw.Region() to draw in the panel.
I noticed a number of the Lines added did not show up until I gave them separate names, so something like this (note the code in bold):
Code:[B]private Series<double> upperGreen1; private Series<double> lowerGreen1;[/B] protected override void OnStateChange() { if (State == State.SetDefaults) { Description = NinjaTrader.Custom.Resource.NinjaScriptIndicatorDescriptionRSI; Name = "aaRSIZones"; IsSuspendedWhileInactive = true; BarsRequiredToPlot = 20; Period = 14; Smooth = 3; [B]DrawOnPricePanel = false; //this makes sure our drawing object isn't drawn on the same panel as the data series[/B] AddPlot(Brushes.DodgerBlue, NinjaTrader.Custom.Resource.NinjaScriptIndicatorNameRSI); AddPlot(Brushes.Goldenrod, NinjaTrader.Custom.Resource.NinjaScriptIndicatorAvg); [B] AddLine(Brushes.Red, 20, "LowerRed20"); AddLine(Brushes.Red, 30, "LowerRed30"); AddLine(Brushes.Green, 40, "UpperGreen40"); AddLine(Brushes.Green, 50, "UpperGreen50"); AddLine(Brushes.Red, 55,"LowerRed55"); AddLine(Brushes.Red, 65, "LowerRed65"); AddLine(Brushes.Green, 80, "UpperGreen80"); AddLine(Brushes.Green, 90, "UpperGreen90");[/B] } else if (State == State.Configure) { // removed for simplicity } else if (State == State.DataLoaded) { //other variables removed [B] upperGreen1 = new Series<double>(this, MaximumBarsLookBack.Infinite); lowerGreen1 = new Series<double>(this, MaximumBarsLookBack.Infinite);[/B] } } protected override void OnBarUpdate() { //removed for simplicity [B] upperGreen1[0] = 50; lowerGreen1[0] = 40; Draw.Region(this, "tag1", CurrentBar, 0, lowerGreen1, upperGreen1, null, Brushes.Green, 100);[/B] //rest of logic removed for space reasons }
Here's a link to our help guide regarding Draw.Region:
Please let us know if we may be of further assistance to you.Kate W.NinjaTrader Customer Service
- Likes 1
-
Originally posted by NinjaTrader_Kate View Post
the Lines added did not show up until I gave them separate names,
...
Make sure you've set DrawOnPricePanel as false or it won't show up correctly.
.
thank you for your reply.
Yes I did not know/thought that the plots needed their names.
I tentatively ... set the false value for the DrawOnPricePanel in the State.SetDefaults and it appeared as doing ok.
My end goal here is being able to set conditions on the SB when there are rsi reversals in either one of the two zones around the 50 level.
Thank you so much for your help.
gt
Last edited by guidoisot; 06-21-2019, 01:27 AM.
Comment
-
Hello Guidoisot,
Thank you for your reply.
You have two options here:
You could either hard code the values into the strategy since they're always the same, or you could expose the Series<double> values so they would be usable in the Strategy Builder. The latter is preferable since then if you want to use it in multiple strategies you don't have to hard code the values again each time.
For example, I could add this to the #region Properties section of the indicator to expose the upperGreen1 line value:
Code:[Browsable(false)] [XmlIgnore] public Series<double> UpperGreen1 // note this is uppercase "U" when our series in the indicator itself starts with a lowercase "u" { get { return upperGreen1; } // Allows our public upperGreen1 Series<double> to access and expose our internal upperGreen1 Series<double> }
https://ninjatrader.com/support/help...alues_that.htm
Please let us know if we may be of further assistance to you.Kate W.NinjaTrader Customer Service
- Likes 1
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by rtwave, 04-12-2024, 09:30 AM
|
4 responses
31 views
0 likes
|
Last Post
by rtwave
Today, 12:50 AM
|
||
Started by yertle, Yesterday, 08:38 AM
|
7 responses
29 views
0 likes
|
Last Post
by yertle
Today, 12:15 AM
|
||
Started by bmartz, 03-12-2024, 06:12 AM
|
2 responses
22 views
0 likes
|
Last Post
by bmartz
Today, 12:11 AM
|
||
Started by funk10101, Today, 12:02 AM
|
0 responses
6 views
0 likes
|
Last Post
by funk10101
Today, 12:02 AM
|
||
Started by gravdigaz6, Yesterday, 11:40 PM
|
1 response
9 views
0 likes
|
Last Post Yesterday, 11:49 PM |
Comment