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

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.
    Browse examples for many languages, with explanations and code side by side for easy understanding.


    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 Day_Storay1, Today, 09:06 PM
          0 responses
          5 views
          0 likes
          Last Post Day_Storay1  
          Started by Rudmax, 07-02-2024, 05:40 AM
          59 responses
          1,052 views
          1 like
          Last Post QuantVPS  
          Started by tomtom2000, Today, 12:56 PM
          3 responses
          18 views
          0 likes
          Last Post jabowery  
          Started by stoner, 01-16-2020, 08:07 AM
          20 responses
          514 views
          0 likes
          Last Post IanS00
          by IanS00
           
          Started by jmschmidt357, 09-06-2024, 04:51 PM
          4 responses
          51 views
          0 likes
          Last Post jabowery  
          Working...
          X