Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Color bars based on RSI condition

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

    Color bars based on RSI condition

    Hi, I was hoping someone could help with converting this code to work in NinjaScript. Here is the ThinkorSwim code I would like converted:

    defineGlobalColor("Long", color.green);
    defineGlobalColor("Short", color.dark_red);

    assignPriceColor(if RSI("length" = 5, "over bought" = 50, "over sold" = 50)."RSI" is greater than RSI("length" = 5, "over bought" = 50, "over sold" = 50)."OverBought" then globalColor("Long") else globalColor("Short"));

    Any help would be greatly appreciated!!

    A bonus would be if the bar colors and the parameters of the RSI could be changed in a parameters box. However if hard coded to the specific parameters I supplied, that would be fine.

    #2
    take a lokk at this one https://ninjatraderecosystem.com/use...olor-gradient/

    Comment


      #3
      I should of mentioned I'm using NinjaTrader 7. If you could supply a link to a version that is compatible with NinjaTrader 7 that would be great. Thanks

      Comment


        #4
        Originally posted by JoeSkeeRock View Post
        I should of mentioned I'm using NinjaTrader 7. If you could supply a link to a version that is compatible with NinjaTrader 7 that would be great. Thanks
        use this one, note the color is based on ma of rsi, however if you set ma = 1 then it is the same as rsi by itself https://ninjatraderecosystem.com/use...e-indicator-3/

        Comment


          #5
          Hello JoeSkeeRock,

          As a tip in NInjaTrader 7 colors are System.Windows.Media.Color objects.

          Below is a link to the microsoft documentation.
          https://docs.microsoft.com/en-us/dot...tframework-4.8

          I'm not certain what assignPriceColor() colors does, but if you want a horizontal line at a price this can be done with DrawHorizontalLine().
          Below is a link to the help guide.
          https://ninjatrader.com/support/help...zontalline.htm

          For coloring bars set BarColor or a bar color by index with BarColorSeries[index barsAgo].

          Chelsea B.NinjaTrader Customer Service

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by CarlTrading, 03-31-2026, 09:41 PM
          1 response
          128 views
          1 like
          Last Post NinjaTrader_ChelseaB  
          Started by CarlTrading, 04-01-2026, 02:41 AM
          0 responses
          73 views
          1 like
          Last Post CarlTrading  
          Started by CaptainJack, 03-31-2026, 11:44 PM
          0 responses
          116 views
          2 likes
          Last Post CaptainJack  
          Started by CarlTrading, 03-30-2026, 11:51 AM
          0 responses
          109 views
          1 like
          Last Post CarlTrading  
          Started by CarlTrading, 03-30-2026, 11:48 AM
          0 responses
          88 views
          0 likes
          Last Post CarlTrading  
          Working...
          X