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 claxxical, 05-30-2017, 12:30 PM
    37 responses
    4,452 views
    0 likes
    Last Post Padan
    by Padan
     
    Started by SugarDefwebsite, Today, 02:18 AM
    0 responses
    3 views
    0 likes
    Last Post SugarDefwebsite  
    Started by usglucofreeze, Today, 01:19 AM
    0 responses
    7 views
    0 likes
    Last Post usglucofreeze  
    Started by f.saeidi, Today, 01:12 AM
    0 responses
    11 views
    0 likes
    Last Post f.saeidi  
    Started by NinjaTrader_ChelseaB, 03-14-2017, 10:17 AM
    227 responses
    34,319 views
    7 likes
    Last Post rare312
    by rare312
     
    Working...
    X