Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

How to color candles based on RSI value?

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

    How to color candles based on RSI value?

    I use a RSI candle indicator in Trading View that colors the candles based on the RSI value. I have it set to one color if the RSI in over 50 and another color if it's less than 50.
    While I have coded a little bit in Pinescript for TradingView, I'm new to indicator development for Ninjatrader and I don't know how to go about making that indicator here.

    Does someone have any advice on how to code this in NinjaTrader?

    #2
    Hello BMinton,

    Thank you for your post.

    We do have resources to help you begin creating NinjaScript Strategies/Indicators. All links below are publicly available.

    If you are new to C#, to get a basic foundation for the concepts and syntax used in NinjaScript I would recommend this section of support articles first:
    Basic Programming Concepts

    For general C# education I have personally found Dot Net Perls to be a great reference site with easy to understand examples.


    We also have some Reference samples online as well as ‘Tips and Tricks’ for both indicators and strategies:
    Click here to see examples created by the support team
    Click here to see our NinjaScript Reference Samples
    Click here to see our NinjaScript Tips

    These samples can be downloaded, installed and modified from NinjaTrader and hopefully serve as a good base for your custom works.

    Also, below I am also linking you to the Educational Resources section of the Help Guide to help you get started with NinjaScript.


    Further, the following link is to our help guide with an alphabetical reference list to all supported methods, properties, and objects that are used in NinjaScript.
    Alphabetical Reference

    And our Educational Resources in the NinjaTrader 8 help guide.
    Educational Resources

    I'm also providing a link to a support article with further helpful resources on getting started with C# and NinjaScript.




    Below is the Help Guide page for the RSI, which includes syntax for how to access the RSI values in your code.



    You can use BarBrushes to change the color of a bar.



    Please let us know if you have any further questions.
    Gaby V.NinjaTrader Customer Service

    Comment


      #3
      Thank you for the response. I'll dive into your info this weekend.

      Comment


        #4
        If you're not familiar with coding, then use the Strategy Builder to suggest useful code. Use it to pick which functions whose code you want to see. For example, if you want to work with the code for when RSI is rising or over a certain value, then choose those functions in Strategy Building and choose View Code.


        Sample Code: Let's say if RSI is rising or greater than a certain value then color price bar green, and if vice versa then color it red.


        if (
        (IsRising(Rsi1) == true)
        ||
        (Rsi1[0] > 30))​​
        )
        {BarBrush = Brushes.Green;}


        if (
        (IsFalling(Rsi1) == true)
        ||
        (Rsi1[0] < 10))​​
        )
        {BarBrush = Brushes.Green;}


        I also suggest utilizing the {BackBrush = Brush1;} / ​{BackBrush = Brushes.Green;} functions to color the chart background. I strongly recommend learning how to adjust the opacity and the hex code to make custom colors. This is helpful to dim the chart background colors so they aren't overpowering. I use dim, dark color to draw BackBrush and bright colors to draw BarBrush. The effect is bright, colorful price bars against the background of dim dark colors corresponding to the output of my oscillators.

        Here's a picture of how I apply these ideas in my own system.


        Comment


          #5
          Thanks for the response. I’ll try that out.

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by johnMoss, Today, 07:31 AM
          7 responses
          20 views
          0 likes
          Last Post NinjaTrader_ChelseaB  
          Started by Skifree, Today, 08:58 AM
          7 responses
          22 views
          0 likes
          Last Post Skifree
          by Skifree
           
          Started by Don David, 04-10-2020, 12:04 PM
          4 responses
          2,512 views
          0 likes
          Last Post NinjaTrader_Erick  
          Started by Powerbucker, Today, 09:17 AM
          1 response
          10 views
          0 likes
          Last Post NinjaTrader_Erick  
          Started by zagier, Today, 05:10 AM
          1 response
          13 views
          0 likes
          Last Post NinjaTrader_ChelseaB  
          Working...
          X