Relating a lower study (RSI, MACD, etc) to price

baroque

New member
VIP
I want an indicator that accurately forces a relationship between a lower study indicator and price. I can watch both and see what is happening and make a successful trade (say on a divergence for example), but I want a single indicator that tells the whole story with precision. So here's what I'm thinking:

1) Break down the price action into peaks and valleys determined by user-defined parameters. Between each peak and valley I call a "movement", and for this example a movement is 1.50 of price on /ES futures. So once the price moves 1.50, a new movement has been established and continues until the price reverses by at least 1.50.

2) The corresponding values of the lower study are being tracked and form their own peaks and valleys aligned with the peaks and valleys of the price (even if the lower study peaks or valleys on a different bar).

3) Once a movement has been established the indicator is tracking the next movement, and a histogram can express a ratio of the current values of each bar against the previous movement. Once that movement finishes, the histogram resets and starts tracking ratios against the most recently completed movement. And so on.

4) You can see how the ratios are calculated in the screen capture below. I used RSI as the lower study but ideally one could apply this to any lower study. For the sake of this example, the lower study is assumed to be a leading indicator and so the ratios give you bearish/bullish indication against the price action.

Screen Shot 2023-07-26 at 3.44.42 PM.png


Does this make sense and is this doable? Any help greatly appreciated!
 
Last edited:
I want an indicator that accurately forces a relationship between a lower study indicator and price. I can watch both and see what is happening and make a successful trade (say on a divergence for example), but I want a single indicator that tells the whole story with precision. So here's what I'm thinking:

1) Break down the price action into peaks and valleys determined by user-defined parameters. Between each peak and valley I call a "movement", and for this example a movement is 1.50 of price on /ES futures. So once the price moves 1.50, a new movement has been established and continues until the price reverses by at least 1.50.

2) The corresponding values of the lower study are being tracked and form their own peaks and valleys aligned with the peaks and valleys of the price (even if the lower study peaks or valleys on a different bar).

3) Once a movement has been established the indicator is tracking the next movement, and a histogram can express a ratio of the current values of each bar against the previous movement. Once that movement finishes, the histogram resets and starts tracking ratios against the most recently completed movement. And so on.

4) You can see how the ratios are calculated in the screen capture below. I used RSI as the lower study but ideally one could apply this to any lower study. For the sake of this example, the lower study is assumed to be a leading indicator and so the ratios give you bearing/bullish indication against the price action.



Does this make sense and is this doable? Any help greatly appreciated!


here are some thoughts and questions and shortcut code

lower

peak =
valley =

move_amt = 1.50

rule1
move_up_lvl =
if valley then low
else if peak then 0
else if move_up_lvl[0] == 0 then 0
else if close - move_up_lvl[1] >= move_amt then move_up_lvl[1] + move_amt
else if move_up_lvl[1] - close >= move_amt then 0
else move_up_lvl[1];


rule2
??
what data produces that squiggly line in the lower?

i expect my move_up_lvl variable to produce a kind of stairstep pattern.

how can they be 'aligned' but on different bars?
...
lower peaks and valleys aligned with the peaks and valleys of the price (even if the lower study peaks or valleys on a different bar)....


rule3
sorry, got lost
your picture has no histogram.
 
Thanks @halcyonguy

2) The lower study squiggly lines in my image is just RSI.

2) On "alignment" between price and lower study I wasn't clear. What I mean to say is to allow the price peak/valley to govern a corresponding series of peaks/valleys in the lower study, and once a "movement" occurs (in the price) then a corresponding movement is locked into place in the lower study. This way you have a discreet set of data from which you can create ratios of both price and lower study with the subsequent bars.

3) A histogram is the lower study I want to create. It would be a value derived from a ratio of ratios. I calculated this value manually for each peak/valley in the example image (shown in yellow text below the price action). But I want a histogram that shows this calculation live during trading. So another example from the image would be at 10:24 where I note "new movement occurs here and is now live." The next bar closes at a price -1.75 from the previous peak. And likewise the RSI value closes at -22.36 from the previous peak. So first we need a price ratio: 1.75/5.25 (where 5.25 is the value of the previous movement)=0.333. Next we need an RSI ratio: 22.36/45.89 (where 45.89 is the value of the previous movement)=0.487. And finally the ratio of ratios is RSI ratio/price ratio: 0.487/0.333=1.462. Then for clarity we take the inverse since it is a downward movement (so that bearish movement is below 1.0): 1/1.462=0.684. So therefore the histogram, at the close of that bar, would show a red bar extending down from the neutral axis valued at 0.684 (where 1.0 is the neutral axis of the histogram). The idea is that the lower study (RSI) is currently "lower" than the price relative to how each behaved in the last movement, so it is therefore bearish.
 

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
489 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