• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

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
    }
    http://ninjatrader.com/support/helpG...plotcolors.htm
    http://ninjatrader.com/support/helpG...nt7/?value.htm
    Paul H.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by dvcpro4, Today, 01:54 PM
    1 response
    2 views
    0 likes
    Last Post Johnny Santiago  
    Started by ttodua, Today, 01:54 PM
    0 responses
    2 views
    0 likes
    Last Post ttodua
    by ttodua
     
    Started by iq200, Today, 01:33 PM
    1 response
    7 views
    0 likes
    Last Post NinjaTrader_PatrickG  
    Started by lunardiplomacy, Today, 07:57 AM
    1 response
    9 views
    0 likes
    Last Post NinjaTrader_Kate  
    Started by PN720, Today, 12:54 PM
    0 responses
    5 views
    0 likes
    Last Post PN720
    by PN720
     
    Working...
    X