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 geotrades1, Today, 10:02 AM
          1 response
          4 views
          0 likes
          Last Post NinjaTrader_BrandonH  
          Started by ender_wiggum, Today, 09:50 AM
          1 response
          5 views
          0 likes
          Last Post NinjaTrader_Gaby  
          Started by rajendrasubedi2023, Today, 09:50 AM
          1 response
          11 views
          0 likes
          Last Post NinjaTrader_BrandonH  
          Started by bmartz, Today, 09:30 AM
          1 response
          9 views
          0 likes
          Last Post NinjaTrader_Erick  
          Started by geddyisodin, Today, 05:20 AM
          3 responses
          26 views
          0 likes
          Last Post NinjaTrader_Gaby  
          Working...
          X