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 argusthome, 03-08-2026, 10:06 AM
    0 responses
    69 views
    0 likes
    Last Post argusthome  
    Started by NabilKhattabi, 03-06-2026, 11:18 AM
    0 responses
    42 views
    0 likes
    Last Post NabilKhattabi  
    Started by Deep42, 03-06-2026, 12:28 AM
    0 responses
    24 views
    0 likes
    Last Post Deep42
    by Deep42
     
    Started by TheRealMorford, 03-05-2026, 06:15 PM
    0 responses
    27 views
    0 likes
    Last Post TheRealMorford  
    Started by Mindset, 02-28-2026, 06:16 AM
    0 responses
    54 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Working...
    X