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 rhyminkevin, Today, 04:58 PM
          3 responses
          46 views
          0 likes
          Last Post Anfedport  
          Started by iceman2018, Today, 05:07 PM
          0 responses
          5 views
          0 likes
          Last Post iceman2018  
          Started by lightsun47, Today, 03:51 PM
          0 responses
          7 views
          0 likes
          Last Post lightsun47  
          Started by 00nevest, Today, 02:27 PM
          1 response
          14 views
          0 likes
          Last Post 00nevest  
          Started by futtrader, 04-21-2024, 01:50 AM
          4 responses
          50 views
          0 likes
          Last Post futtrader  
          Working...
          X