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!
See more
See less

Partner 728x90

Collapse

Change the colour of a plot of a named indic

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Change the colour of a plot of a named indic

    NT Forum,

    Leveraging off the example provided by koganam (http://ninjatrader.com/support/forum...7907#poststop)), in the below code what changes must be made to
    1) plot the added _sma object, and
    2) set the _sma plot color (e.g. Color.Green)

    Code:
    public class exampleIndicator : Indicator
    {
      private SMA _sma;
      private int _period = 12;
    
      protected override void Initialize()
      {
        //  ??  Add(new Plot(Color.Green, "SMA"));
      }
    
      protected override void OnStartUp()
      {
        _sma = SMA(_period);
      }
      
      protected override void OnBarUpdate()
      {
        // code referencing _sma
      }
    }
    Thanks
    Shannon

    #2
    Hello Shansen,

    Thanks for your post.

    Here is an example using your code:

    Code:
    private SMA _sma;
    private int _period = 12;
    
    protected override void OnStartUp()
    {
      _sma = SMA(_period);
    }		
    		
    protected override void OnBarUpdate()
    {
    Value.Set(_sma[0]);    // set for output
    PlotColors[0][0] = Color.Red;  // set Plot color
    }

    Paul H.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by unpronounceable1700, Today, 03:00 AM
    2 responses
    25 views
    0 likes
    Last Post unpronounceable1700  
    Started by unpronounceable1700, Today, 04:53 AM
    1 response
    26 views
    0 likes
    Last Post NinjaTrader_Jesse  
    Started by ninza33, Today, 07:26 AM
    1 response
    16 views
    0 likes
    Last Post NinjaTrader_Zachary  
    Started by gyilaoliver, Today, 03:31 AM
    1 response
    9 views
    0 likes
    Last Post NinjaTrader_Jesse  
    Started by RISKYBUSINEZZ, Yesterday, 09:09 PM
    2 responses
    14 views
    0 likes
    Last Post RISKYBUSINEZZ  
    Working...
    X