Finding the bar that corresponds to a particular RSI point
Author: topcat77
Creation Date: 9/29/2008 7:27 PM
profile picture

topcat77

#1
For another angle on divergence, I would like to locate the bar that corresponds to the lowest Rsi point during a lookback period:

so, for example, if the last bar i) has the lowest-low price for the period and ii)that low price is lower than the lower Bollinger Band, but ii)the Rsi for this bar is not the lowest Rsi for the period, then find the lowest rsi point for the period and if the low-price of the bar that corresponds to that point is higher than the low price of the last bar then there is divergence.

The reason I need to locate the bar that corresponds to the lowest rsi point is to compare not only their low prices but also the magnitude of their divergences (differences in low-price and rsi) between that bar and the last bar and to compare their volumes

Has anyone written a script that accomplishes some (or all) of this ?



profile picture

Eugene

#2
QUOTE:
Has anyone written a script that accomplishes some (or all) of this ?

Yes. Some of the divergence trading ideas (e.g. price sets a lowest low but the indicator fails to confirm the new low and turns up) can be found in TASC article code:

TASC 2008-07 | Leader Of The MACD (Siligardos)
TASC 2008-10 | Asymmetric RSI, ARSI (Vervoort)

QUOTE:
I need to locate the bar that corresponds to the lowest rsi point

Use LowestBar( Series, Period ). Click "More info" with the indicator's entry highlighted in the Indicators list.
profile picture

Eugene

#3
QUOTE:
so, for example, if the last bar i) has the lowest-low price for the period and ii)that low price is lower than the lower Bollinger Band, but ii)the Rsi for this bar is not the lowest Rsi for the period, then find the lowest rsi point for the period and if the low-price of the bar that corresponds to that point is higher than the low price of the last bar then there is divergence.


Here's that example:

CODE:
Please log in to see this code.
profile picture

topcat77

#4
You're the best
Thank You
profile picture

jupiter

#5
Hi Eugene,

The article "TASC 2008-10 | Asymmetric RSI, ARSI (Vervoort)" only shows long trades using positive divergence. Please add codes for shorting using negative divergence (similar to what shown in "TASC 2008-07 | Leader Of The MACD (Siligardos)").

I'd like to be able to go long and short using both positive and negative divergence with ARSI. Thank you very much for your help.
profile picture

Eugene

#6
Looks like the two articles follow exactly the same divergence programming pattern. The rules are just reversed, so it should take a minuscule effort:

1) Copy & paste the shorting code from TASC 2008-07 right after the original long-entry code block, and
2) Replace SellAtMarket with ExitAtMarket.

Make sure to also copy all required variables (i.e. peak, peakBar, high). Let me know if there's a problem.
profile picture

TrendCatcher

#7
Hi Eugene,
Could you see what's wrong with the code below. I tried to edit as you said above.

CODE:
Please log in to see this code.

profile picture

Eugene

#8
Looks like a copy/paste error somewhere, plus you didn't copy the variable definitions. Anyway, here's the code that shorts at market:
CODE:
Please log in to see this code.

Don't forget to use the CODE tags, our eyes will last longer ;)
profile picture

TrendCatcher

#9
Thank you very much. Please give us some classes (online?). :)
This website uses cookies to improve your experience. We'll assume you're ok with that, but you can opt-out if you wish (Read more).