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]

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by CarlTrading, Yesterday, 11:51 AM
    0 responses
    17 views
    0 likes
    Last Post CarlTrading  
    Started by CarlTrading, Yesterday, 11:48 AM
    0 responses
    22 views
    0 likes
    Last Post CarlTrading  
    Started by CaptainJack, 03-25-2026, 09:53 PM
    0 responses
    17 views
    0 likes
    Last Post CaptainJack  
    Started by CaptainJack, 03-25-2026, 09:51 PM
    0 responses
    13 views
    0 likes
    Last Post CaptainJack  
    Started by Mindset, 03-23-2026, 11:13 AM
    0 responses
    20 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Working...
    X