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

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 bortz, 11-06-2023, 08:04 AM
          47 responses
          1,611 views
          0 likes
          Last Post aligator  
          Started by jaybedreamin, Today, 05:56 PM
          0 responses
          9 views
          0 likes
          Last Post jaybedreamin  
          Started by DJ888, 04-16-2024, 06:09 PM
          6 responses
          19 views
          0 likes
          Last Post DJ888
          by DJ888
           
          Started by Jon17, Today, 04:33 PM
          0 responses
          6 views
          0 likes
          Last Post Jon17
          by Jon17
           
          Started by Javierw.ok, Today, 04:12 PM
          0 responses
          22 views
          0 likes
          Last Post Javierw.ok  
          Working...
          X