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

Shade zones in RSI

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

    Shade zones in RSI

    Hello,

    I've seen examples of shading using draw.region for EMAs on the chart, how can i shade a region for my RSI? For example, i want to shade everything in between 70 and 30 a gray color and when the value of RSI goes above 70 i want that to be colored red until i comes down below 70 and vice versa, if it goes below 30, to shade the color green until it crosses back up above 30. ?


    Please let me know if there is good example of this anywhere that i can refer to.

    Thanks,

    #2
    Hello priceisking,

    Thanks for your post.

    I would suggest a couple of approaches.

    For the region between 30 and 70 to be a gray I would suggest using Draw.RegionHighLightY(): https://ninjatrader.com/support/help...highlighty.htm
    You could draw this once, like when CurrentBar == 0) and then not have to worry about it.

    For the other parts you will need to use Draw.Region() and specify the RSI as the series and then the value of 70 or 30 to draw the color between. Your code will need to detect when it cross above and below those values in order to draw the region. The logic for such a thing would be to save the bar number where the RSI crosses above the 70 and use the bar number as part of the name of the region (tag name). As the indicator progresses you update the region to the current bar and redraw from the crossover point (bar number that you saved) So for each excursion above 70 and below 30, you will be creating separately (tag) named regions. By saving the cross bar number as part of the name of the region, you can redraw the region on the next bar and this will prevent the mistake of creating a new region on each bar. You can see an example of this logic in https://ninjatraderecosystem.com/use...acrossbuilder/
    Paul H.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Stanfillirenfro, Yesterday, 09:19 AM
    7 responses
    51 views
    0 likes
    Last Post NinjaTrader_Gaby  
    Started by TraderCro, 04-12-2024, 11:36 AM
    4 responses
    69 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by Mindset, Yesterday, 02:04 AM
    1 response
    15 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by agclub, 04-21-2024, 08:57 PM
    4 responses
    18 views
    0 likes
    Last Post NinjaTrader_Gaby  
    Started by Irukandji, Today, 04:58 AM
    0 responses
    6 views
    0 likes
    Last Post Irukandji  
    Working...
    X