I am after an SMA indicator which color changes depending on the slope. Would anyone have this indicator for NT8? thanks in advance
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
SMA Color change
Collapse
X
-
Hello borge,
Thank you for your note.
Actually, the example on this page does exactly that - it's an SMA that colors the plot depending on whether the line is rising or falling:
This is meant as an example, but I believe it does what you're looking for.
Please let us know if we may be of further assistance to you.Kate W.NinjaTrader Customer Service
-
Hello borge,
Thank you for your reply.
My mistake there, I got that example mixed up with this one from our User App Share that is a similar existing script that demonstrates this using the EMA that can be adapted to your needs.
Below is a public link to the User App Share section of the NinjaTrader Ecosystem.
https://ninjatraderecosystem.com/use...emaslopecolor/
This script could be copied and then modified to call the SMA instead of the EMA.
I am happy to answer any questions you may have about NinjaScript if you decide to code this yourself.
This thread will remain open for any community members that may know of an existing script that already uses the SMA or would like to make the modifications on your behalf.
You can also contact a professional NinjaScript Consultant who would be eager to create or modify this script at your request or assist you with your script. The NinjaTrader Ecosystem has affiliate contacts who provide educational as well as consulting services. Please let me know if you would like our business development follow up with you with a list of affiliate consultants who would be happy to create this script or any others at your request.
Please let us know if we may be of further assistance to you.
The NinjaTrader Ecosystem website is for educational and informational purposes only and should not be considered a solicitation to buy or sell a futures contract or make any other type of investment decision. The add-ons listed on this website are not to be considered a recommendation and it is the reader's responsibility to evaluate any product, service, or company. NinjaTrader Ecosystem LLC is not responsible for the accuracy or content of any product, service or company linked to on this website.Kate W.NinjaTrader Customer Service
Comment
-
Hello borge,
Thank you for your reply.
It's likely it's just labeling the plot as EMA_Slope_Color unless you changed that to say SMA_Slope_Color.
Just make sure you're also changed any references to "EMA" in the script to SMA:
Code:namespace NinjaTrader.NinjaScript.Indicators { public class SMASlopeColor : Indicator { protected override void OnStateChange() { if (State == State.SetDefaults) { Description = @"SMASlopeColor"; Name = "SMASlopeColor"; Calculate = Calculate.OnBarClose; IsOverlay = true; DisplayInDataBox = true; DrawOnPricePanel = true; DrawHorizontalGridLines = true; DrawVerticalGridLines = true; PaintPriceMarkers = true; ScaleJustification = NinjaTrader.Gui.Chart.ScaleJustification.Right; //Disable this property if your indicator requires custom values that cumulate with each new market data event. //See Help Guide for additional information. IsSuspendedWhileInactive = true; Period = 14; UpColor = Brushes.LimeGreen; DnColor = Brushes.Red; ColorSlope = true; AddPlot(Brushes.Orange, "SMA_Slope_Color"); } } protected override void OnBarUpdate() { Value[0] = SMA(Period)[0]; if(IsRising(Value)) { if(ColorSlope) PlotBrushes[0][0] = UpColor; } if(IsFalling(Value)) { if(ColorSlope) PlotBrushes[0][0] = DnColor; } } #region Properties [NinjaScriptProperty] [Range(1, int.MaxValue)] [Display(Name="Period", Description="Number of bars to include in the calculation", Order=1, GroupName="Parameters")] public int Period { get; set; } [NinjaScriptProperty] [XmlIgnore] [Display(Name="Up Color", Description="Color for rising condition", Order=3, GroupName="Parameters")] public Brush UpColor { get; set; } [Browsable(false)] public string UpColorSerializable { get { return Serialize.BrushToString(UpColor); } set { UpColor = Serialize.StringToBrush(value); } } [NinjaScriptProperty] [XmlIgnore] [Display(Name="Down Color", Description="Color for falling condition", Order=4, GroupName="Parameters")] public Brush DnColor { get; set; } [Browsable(false)] public string DnColorSerializable { get { return Serialize.BrushToString(DnColor); } set { DnColor = Serialize.StringToBrush(value); } } [NinjaScriptProperty] [Display(Name="Enable Slope Color?", Description="Color the plot?", Order=2, GroupName="Parameters")] public bool ColorSlope { get; set; } [Browsable(false)] [XmlIgnore] public Series<double> SMA_Slope_Color { get { return Values[0]; } } #endregion } }
Please let us know if we may be of further assistance to you.Kate W.NinjaTrader Customer Service
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by DawnTreader, 05-08-2024, 05:58 PM
|
17 responses
62 views
0 likes
|
Last Post Today, 05:36 AM | ||
Started by ttrader23, 05-08-2024, 09:04 AM
|
10 responses
48 views
0 likes
|
Last Post Today, 05:21 AM | ||
Started by agclub, 04-21-2024, 08:57 PM
|
6 responses
40 views
0 likes
|
Last Post Today, 05:18 AM | ||
Started by thumper57, 05-11-2024, 04:30 PM
|
9 responses
28 views
0 likes
|
Last Post
by thumper57
Today, 05:16 AM
|
||
Started by Seneca, 08-25-2020, 08:31 AM
|
2 responses
5,945 views
0 likes
|
Last Post
by Tin34
Today, 05:03 AM
|
Comment