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 Mindset, 04-21-2026, 06:46 AM
    0 responses
    110 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by M4ndoo, 04-20-2026, 05:21 PM
    0 responses
    156 views
    0 likes
    Last Post M4ndoo
    by M4ndoo
     
    Started by M4ndoo, 04-19-2026, 05:54 PM
    0 responses
    74 views
    0 likes
    Last Post M4ndoo
    by M4ndoo
     
    Started by cmoran13, 04-16-2026, 01:02 PM
    0 responses
    125 views
    0 likes
    Last Post cmoran13  
    Started by PaulMohn, 04-10-2026, 11:11 AM
    0 responses
    79 views
    0 likes
    Last Post PaulMohn  
    Working...
    X