Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

SMA Color Change Indicator

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

    SMA Color Change Indicator

    Hello all,

    I have a useful Indicator that measures the slope angle of a sma, thus giving the prevailing trend direction and colors the SMA line green for slope up and red for slope down and black for flat or no slope.

    I have unfortunately noticed that in active moving markets that at times I noticed that once a bar close and prints a color for that SMA line, that sometimes the indicator repaints 2 bars back and changes the previous closed color. Thus making back testing and live markets look different.

    Can anyone please help in changing the repaint option in the code. I would highly appreciate it. Even perhaps a audio alert for trend up or trend down.

    Very simple but very useful indicator for all. I hope you find a home for it in your strategy. Thank You in advance.
    Attached Files

    #2
    Hello denalek2419,

    Thank you for your post and welcome to the NinjaTrader Support Forum!

    Is this an indicator you have created or a third party?

    The redraw is occurring when the Plots are being set 1 bar back with a new color based on the conditions. For example:
    Code:
    				if(sma34slope>=angle2)
    				{
    					SMAslopeup.Set(1,SMA(Period)[1]); // this sets the slope up plot 1 bar back
    					SMAslopeup.Set(SMA(Period)[0]);
    				}
    There are several plots that are using different colors and then being set to the SMA(period).

    Please take a look at our multi-color plot sample at the following link: http://ninjatrader.com/support/forum...ead.php?t=3227

    Comment


      #3
      Originally posted by NinjaTrader_PatrickH View Post
      Hello denalek2419,

      Thank you for your post and welcome to the NinjaTrader Support Forum!

      Is this an indicator you have created or a third party?

      The redraw is occurring when the Plots are being set 1 bar back with a new color based on the conditions. For example:
      Code:
      				if(sma34slope>=angle2)
      				{
      					SMAslopeup.Set(1,SMA(Period)[1]); // this sets the slope up plot 1 bar back
      					SMAslopeup.Set(SMA(Period)[0]);
      				}
      There are several plots that are using different colors and then being set to the SMA(period).

      Please take a look at our multi-color plot sample at the following link: http://ninjatrader.com/support/forum...ead.php?t=3227
      Thank you for the input. I have made the adjustments and will compare and contrast. The indicator is public domain.

      Thanks!!

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Geovanny Suaza, 02-11-2026, 06:32 PM
      0 responses
      559 views
      0 likes
      Last Post Geovanny Suaza  
      Started by Geovanny Suaza, 02-11-2026, 05:51 PM
      0 responses
      324 views
      1 like
      Last Post Geovanny Suaza  
      Started by Mindset, 02-09-2026, 11:44 AM
      0 responses
      101 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by Geovanny Suaza, 02-02-2026, 12:30 PM
      0 responses
      546 views
      1 like
      Last Post Geovanny Suaza  
      Started by RFrosty, 01-28-2026, 06:49 PM
      0 responses
      547 views
      1 like
      Last Post RFrosty
      by RFrosty
       
      Working...
      X