Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Question adding an indicator to a Chart

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

    Question adding an indicator to a Chart

    Hello,

    I know that I can add an indicator to a chart using the next method inside DataLoaded state:

    AddChartIndicator(SMA(20));

    My question is, what is the fastest way of changing the default color of that indicator?

    Can I do that adding a line code like we used to do with NinjaTrader 7? Something like this: SMA(20).Plots[0].Pen.Color = Color.Blue;

    Or do I need to create an object of the class SMA and after that customize the object as is shown in the SampleMACrossOver strategy for NT8?

    Any shortcut?

    Thanks.

    #2
    Hello Plaket,
    Thanks for your post.

    You would want to set the Brush of the plot by doing something similar to the following:
    Code:
    else if (State == State.DataLoaded)
    {
        SMA(20).Plots[0].Brush = Brushes.Red;
        AddChartIndicator(SMA(20));
    }
    Please see the following link for more information on adding indicators to strategies: https://ninjatrader.com/support/help..._strategie.htm
    Josh G.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by NullPointStrategies, Today, 05:17 AM
    0 responses
    51 views
    0 likes
    Last Post NullPointStrategies  
    Started by argusthome, 03-08-2026, 10:06 AM
    0 responses
    129 views
    0 likes
    Last Post argusthome  
    Started by NabilKhattabi, 03-06-2026, 11:18 AM
    0 responses
    69 views
    0 likes
    Last Post NabilKhattabi  
    Started by Deep42, 03-06-2026, 12:28 AM
    0 responses
    42 views
    0 likes
    Last Post Deep42
    by Deep42
     
    Started by TheRealMorford, 03-05-2026, 06:15 PM
    0 responses
    46 views
    0 likes
    Last Post TheRealMorford  
    Working...
    X