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 CarlTrading, 03-31-2026, 09:41 PM
          1 response
          84 views
          1 like
          Last Post NinjaTrader_ChelseaB  
          Started by CarlTrading, 04-01-2026, 02:41 AM
          0 responses
          46 views
          0 likes
          Last Post CarlTrading  
          Started by CaptainJack, 03-31-2026, 11:44 PM
          0 responses
          66 views
          2 likes
          Last Post CaptainJack  
          Started by CarlTrading, 03-30-2026, 11:51 AM
          0 responses
          69 views
          0 likes
          Last Post CarlTrading  
          Started by CarlTrading, 03-30-2026, 11:48 AM
          0 responses
          58 views
          0 likes
          Last Post CarlTrading  
          Working...
          X