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 Brevo, Today, 01:45 AM
      0 responses
      3 views
      0 likes
      Last Post Brevo
      by Brevo
       
      Started by aussugardefender, Today, 01:07 AM
      0 responses
      3 views
      0 likes
      Last Post aussugardefender  
      Started by pvincent, 06-23-2022, 12:53 PM
      14 responses
      239 views
      0 likes
      Last Post Nyman
      by Nyman
       
      Started by TraderG23, 12-08-2023, 07:56 AM
      9 responses
      384 views
      1 like
      Last Post Gavini
      by Gavini
       
      Started by oviejo, Today, 12:28 AM
      0 responses
      6 views
      0 likes
      Last Post oviejo
      by oviejo
       
      Working...
      X