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 Geovanny Suaza, 02-11-2026, 06:32 PM
          0 responses
          571 views
          0 likes
          Last Post Geovanny Suaza  
          Started by Geovanny Suaza, 02-11-2026, 05:51 PM
          0 responses
          330 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
          548 views
          1 like
          Last Post Geovanny Suaza  
          Started by RFrosty, 01-28-2026, 06:49 PM
          0 responses
          549 views
          1 like
          Last Post RFrosty
          by RFrosty
           
          Working...
          X