Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Formatting an indicator from "Strategies"

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

    Formatting an indicator from "Strategies"

    I saw that you could include indicators in the "Initialize" section of a strategy and found it to be quite handy (as seen in SampleMultiTimeFrame below). Is there any way to format the SMAs from the strategy script. Currently, they both just come out orange and it's hard to tell which is which on first glance.

    Thanks,

    DTK

    protectedoverridevoid Initialize()
    {
    // Add a 5 minute Bars object to the strategy
    Add(PeriodType.Minute, 5);

    // Add a 15 minute Bars object to the strategy
    Add(PeriodType.Minute, 15);

    // Note: Bars are added to the BarsArray and can be accessed via an index value
    // E.G. BarsArray[1] ---> Accesses the 5 minute Bars object added above
    // Add simple moving averages to the chart for display
    // This only displays the SMA's for the primary Bars object on the chart
    Add(SMA(5));
    Add(SMA(
    50));

    CalculateOnBarClose =
    true;
    }

    #2
    Code:
    [SIZE=2][SIZE=2]SMA(Hi 8DTK8,
     
    Thanks for your post!
     
    Please add this code after the Add(SMA) lines in your code, this will then color your two SMA's the strategy displays.
     
    [SIZE=2][COLOR=#800080][SIZE=2][COLOR=#800080][SIZE=2][COLOR=#800080]5[/COLOR][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][SIZE=2]).Plots[[/SIZE][/SIZE][SIZE=2][COLOR=#800080][SIZE=2][COLOR=#800080][SIZE=2][COLOR=#800080]0[/COLOR][/SIZE][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][SIZE=2]].Pen.Color = Color.Blue;[/SIZE][/SIZE]
    [SIZE=2][SIZE=2][SIZE=2][SIZE=2]SMA([/SIZE][/SIZE][SIZE=2][COLOR=#800080][SIZE=2][COLOR=#800080][SIZE=2][COLOR=#800080]50[/COLOR][/SIZE][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][SIZE=2]).Plots[[/SIZE][/SIZE][SIZE=2][COLOR=#800080][SIZE=2][COLOR=#800080][SIZE=2][COLOR=#800080]0[/COLOR][/SIZE][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][SIZE=2]].Pen.Color = Color.Red;[/SIZE]
    [/SIZE][/SIZE][/SIZE]
    [/SIZE][/SIZE][/SIZE]
    BertrandNinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by andrewtrades, Today, 04:57 PM
    1 response
    5 views
    0 likes
    Last Post NinjaTrader_Manfred  
    Started by chbruno, Today, 04:10 PM
    0 responses
    3 views
    0 likes
    Last Post chbruno
    by chbruno
     
    Started by josh18955, 03-25-2023, 11:16 AM
    6 responses
    436 views
    0 likes
    Last Post Delerium  
    Started by FAQtrader, Today, 03:35 PM
    0 responses
    7 views
    0 likes
    Last Post FAQtrader  
    Started by rocketman7, Today, 09:41 AM
    5 responses
    19 views
    0 likes
    Last Post NinjaTrader_Jesse  
    Working...
    X