Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Adding Indicators

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

    Adding Indicators

    Just a quick question:

    Code:
    [FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2]
    Add(EMA(Close, [/SIZE][/FONT][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080]512[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2]).Plots[[/SIZE][/FONT][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080]0[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2]].Pen.Color = Color.Blue);
    [/SIZE][/FONT][/SIZE][/FONT]
    how do you colorize indicators within a strategy ?


    #2
    Hello Faspomy,

    Please see this reference sample:
    Strategy: Plotting from within a NinjaScript Strategy

    You'll have to separate the add statment from the statement that defines your color.
    Ryan M.NinjaTrader Customer Service

    Comment


      #3
      Hi NT Ryan,

      I tried this:

      Code:
      [FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2]
      SMA([/SIZE][/FONT][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080]20[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2]).Plots[[/SIZE][/FONT][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080]0[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2]].Pen.Color = Color.Blue;
      Add(SMA(Close, [/SIZE][/FONT][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080]20[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2]));
      [/SIZE][/FONT][/SIZE][/FONT]

      SMA(20) shows up yellow.

      Comment


        #4
        Hi Faspomy,

        Use the same overload. In the example below, neither has "Close" specified.

        Code:
        SMA(20).Plots[0].Pen.Color = Color.Blue;
        Add(SMA(20));
        or:

        Code:
         
        SMA(Close, 20).Plots[0].Pen.Color = Color.Blue;
        Add(SMA(Close, 20));
        Ryan M.NinjaTrader Customer Service

        Comment


          #5
          I see.

          Thank you !

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by Geovanny Suaza, 02-11-2026, 06:32 PM
          0 responses
          670 views
          0 likes
          Last Post Geovanny Suaza  
          Started by Geovanny Suaza, 02-11-2026, 05:51 PM
          0 responses
          379 views
          1 like
          Last Post Geovanny Suaza  
          Started by Mindset, 02-09-2026, 11:44 AM
          0 responses
          111 views
          0 likes
          Last Post Mindset
          by Mindset
           
          Started by Geovanny Suaza, 02-02-2026, 12:30 PM
          0 responses
          575 views
          1 like
          Last Post Geovanny Suaza  
          Started by RFrosty, 01-28-2026, 06:49 PM
          0 responses
          582 views
          1 like
          Last Post RFrosty
          by RFrosty
           
          Working...
          X