Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

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 judysamnt7, 03-13-2023, 09:11 AM
      4 responses
      59 views
      0 likes
      Last Post DynamicTest  
      Started by ScottWalsh, Today, 06:52 PM
      4 responses
      36 views
      0 likes
      Last Post ScottWalsh  
      Started by olisav57, Today, 07:39 PM
      0 responses
      7 views
      0 likes
      Last Post olisav57  
      Started by trilliantrader, Today, 03:01 PM
      2 responses
      21 views
      0 likes
      Last Post helpwanted  
      Started by cre8able, Today, 07:24 PM
      0 responses
      10 views
      0 likes
      Last Post cre8able  
      Working...
      X