High, low and close of RSI value for current candlestick

Esminiguu

New member
Hello,

I want to see the highest, lowest and closed RSI value for each candlestick.

Let's say the RSI close was 49. I would like to know if at any point in the candle it crossed the RSI 50 mark. Is there an easy way to achieve this with thinkscript?

Thank you,
 
I tried that but I don't think that's what I'm looking for exactly. I still want the previous RSI calculated off the close price but I want the "range" that the RSI was during the aggregation period.
 
@Esminiguu I'm guessing that you just want the previous high/low RSI values. What do you mean by "range" of the RSI? How and where would you want this information displayed, on the lower RSI indicator as bubbles/labels, on the upper chart as a label? Dont know if I can do it yet, I need more information.
 
@Pensar For example, I trade with the 5 minute candlesticks. As the 5 minute candlestick is forming the RSI indicator value is fluctuating. At one point it may be 50, at another point it may be 47. I would like to know what the highest and lowest point the RSI value was during the 5 minute candle.
 
@Esminiguu I've looked into plotting the highest and lowest values of the RSI() during each pricebar . . . I'm not certain if it can be done. @mashume If you dont mind, could you please look at this? I'd appreciate your thoughts and ideas.
Thanks for the vote of confidence in my coding... Warranted or not, who can say eh?

My first thought is to do something along these lines. Assume that we want the RSI to be based on the CLOSE price, we can create two data series that have the close up to the last bar and then use the high and low of the last candle as the datum for their series, in effect giving us two data series that represent the highest and lowest values of the RSI for the last candle.
The drawback of this is that it won't be available to back test since as soon as there is a close, that will be used instead of the H/L for the bar.

Some code to illustrate:
Code:
def series_h = if isNaN(close) then HIGH else CLOSE;
def series_l = if isNan(close) then LOW  else CLOSE;

plot RSI_H = RSI(price = series_h);
plot RSI_L = RSI(price = series_l);

Now, having coded that up, I wonder if making the RSI_H and RSI_L as def statements and then plotting them separately would preserve the high and low RSI, or just muddle things up a bunch.

Of course, I haven't tested any of this in ThinkOrSwim, it's all been typed straight from brain to UseThinkScript. So it may blow up on you, or empty your accounts if you trade with it, and it probably won't do at all what either you or I think it may.

But it is an idea.

-mashume
 
Perhaps this:
Code:
declare lower;

def series_h = if isNaN(close[-1]) then HIGH else CLOSE;
def series_l = if isNan(close[-1]) then LOW  else CLOSE;

def RSI_H = RSI(price = series_h);
def RSI_L = RSI(price = series_l);

plot RSI_U = RSI_H;
plot RSI_D = RSI_L;
plot RSI_O = RSI();

addLabel(yes, concat("High: ", RSI_H), color.dark_green);
addLabel(yes, concat("RSI: ", RSI_o), color.dark_gray);
addLabel(yes, concat("Low: ", RSI_L), color.dark_red);

def RSI_Pct = if RSI_L != RSI_O then ((RSI_O - RSI_L) / (RSI_H - RSI_L)) * 100 else 0;

addLabel(yes, concat(RSI_Pct, " %"), color.Blue);

Shows three distinct values for the current bar, though the labels are the useful part as the differences are small.

-mashume
 
Last edited:
@mashume Wow that's amazing. This is exactly what I was looking for. Is it possible to show to previous highs and lows too?
Not likely with this method. To calculate the RSI by the standard, we create the data series so that only the current bar is not close. When we move to the next bar, we WANT the value for the past bars to be close, so that we calculate the RSI by the traditional method. I'm not sure how to preserve the values.

Plotting an RSI built using the series of HIGH or LOW values does NOT match the values of RSI high that this study shows.

Life, and data are transitory -- enjoy them while they're around. :)

-mashume
 

Join useThinkScript to post your question to a community of 21,000+ developers and traders.

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
294 Online
Create Post

Similar threads

Similar threads

The Market Trading Game Changer

Join 2,500+ subscribers inside the useThinkScript VIP Membership Club
  • Exclusive indicators
  • Proven strategies & setups
  • Private Discord community
  • ‘Buy The Dip’ signal alerts
  • Exclusive members-only content
  • Add-ons and resources
  • 1 full year of unlimited support

Frequently Asked Questions

What is useThinkScript?

useThinkScript is the #1 community of stock market investors using indicators and other tools to power their trading strategies. Traders of all skill levels use our forums to learn about scripting and indicators, help each other, and discover new ways to gain an edge in the markets.

How do I get started?

We get it. Our forum can be intimidating, if not overwhelming. With thousands of topics, tens of thousands of posts, our community has created an incredibly deep knowledge base for stock traders. No one can ever exhaust every resource provided on our site.

If you are new, or just looking for guidance, here are some helpful links to get you started.

What are the benefits of VIP Membership?
VIP members get exclusive access to these proven and tested premium indicators: Buy the Dip, Advanced Market Moves 2.0, Take Profit, and Volatility Trading Range. In addition, VIP members get access to over 50 VIP-only custom indicators, add-ons, and strategies, private VIP-only forums, private Discord channel to discuss trades and strategies in real-time, customer support, trade alerts, and much more. Learn all about VIP membership here.
How can I access the premium indicators?
To access the premium indicators, which are plug and play ready, sign up for VIP membership here.
Back
Top