How It Works Chart Features House Rules Moderators For the WEB Widgets Stock Charting Library Feature Request FAQ Help & Wiki Twitter

699 7
This study is used to detect Overbought/Oversold levels, reversal patterns, momentum divergence based on the ratio of the current level vs the trading range on a given period of time. It reduces the lag by using direct price levels instead of moving averages, and the results are smoothed using the supersmooth Ehler's filter.

This study utilizes simple parameters, the length of the analysis period and check boxes to display only the bull vector, the bear vector, or both of them.

When the vector crosses over the zero line, the stock is in the bull side, if it reaches levels above 80% it enters to the Overbought area, which means the price can go higher until a reversal takes it below the Zero Line to the Bear side, where if it reaches -80% it is said to be at the Oversold level until a reversal or a momentum divergence pattern flags a return to the Bull side.
```// Madrid : 01/Mar/2015 :12:00 : Madrid Vector : 1.0
// The vector is calculated as a ratio between (Cn-Ref)/(Hn-L1) for a given
// period of time

src = close
vectorLen=input(34)
dispBull = input(false)
dispBear = input(false)
dispBullvsBear = input(true)
OS = -76.4, OB = 76.4

lowerBand = 10
PI= 3.14159265358979
ssFilter( price, lowerBand ) =>
angle = sqrt(2)*PI/lowerBand
a1= exp(-angle)
b1 = 2*a1*cos(angle)
c2 = b1
c3 = -a1*a1
c1 = 1 - c2 -c3
filt = c1*(price + nz(price[1]))/2 + c2*nz(filt[1]) + c3*nz(filt[2])

highestRef= highest(src, vectorLen)
lowestRef = lowest(src, vectorLen)

// Bull Vector
bullVector = (src-lowestRef)*100/(highestRef-lowestRef)
ssBullVector = ssFilter(bullVector, lowerBand)
bullVectorColor = change(ssBullVector)>=0?lime:green
plot(dispBull?ssBullVector*2-100:na, color=bullVectorColor, linewidth=2)

// Bear Vector
bearVector = (highestRef-src)*100/(highestRef-lowestRef)
ssBearVector = ssFilter(bearVector, lowerBand)
bearVectorColor = change(ssBearVector)>=0?red:maroon
plot(dispBear?ssBearVector*2-100:na, color=bearVectorColor,linewidth=2)

bullVSbear = bullVector - bearVector
ssBullVSBear = ssFilter(bullVSbear, lowerBand)

bullVSBearHist = change(ssBullVSBear,1)
plot(dispBullvsBear?ssBullVSBear:na, linewidth=2, color=bullVSBearHist>=0?green:red)
top = hline(110, color=red, linestyle=dotted)
bottom = hline(-110, color=lime, linestyle=dotted)
obLvl = hline(OB, color=red, linestyle=dotted)
hline(0, color=gray, linestyle=dotted)
osLvl = hline(OS, color=lime, linestyle=dotted)
fill(obLvl, top, color=red, transp=80)
fill(osLvl, bottom, color=lime, transp=80)

```
Interesting idea!

I tested it and it seems to react too fast though. The bull vs bear market vector is not in sync with the price action as you can see in my example. Maybe you find a way to filter extreme values so that your indicator does not overreact to them:

ChartArt
I set the default value of the indicator to 34, which is not so reactive. I personally use the values 13, 34 and 89, depending on which cycle I'm analyzing. The time frame you used, due to the limited amount of historic data, doesn't allow you to use this default parameter, but you can use a lower time frame and increase the value of the vector length.

On the other hand, look at the information the indicator provides you:

As soon as it has data to process it shows an uptrend in the bull side (Above the Zero line) it reaches a peak and starts to decrease (change of color), which means it has reached a resistance level and it's gone through a retracement. When this happens the indicator may exit the overbought area, but as long as it doesn't leave the Bull side it means this is doing a bull flag and the price will retest the resistance level.

As soon as the peak rises, you can see that the indicator doesn't reach a level higher level than the previous peak, so it means that it is entering the OB area with a negative momentum divergence, it is warning in advance that the peak it is forming can ignite a downtrend, which is confirmed by the red bar right after the peak.

You can see that the Bear vector is doing one of the patterns I show in my example, that looks like a slanted "W", when either vector does the W pattern it means you'll have a reversal.
As soon as the indicator starts to decrease you know it is very likely this is a downtrend.

You have a trend when the values of the vector are at the extremes. When the values approach zero and are around the Zero line it means indecision, It remained there for four months according to your chart and when it resumed the trend it went down, which is shown when the Bull vector crosses down the Zero and approaches the Oversold area line and the Bear vector goes to Overbought.

What the indicator tells you now is that the bull vector has remained at the Oversold level and is consolidating, there are no signs of reversal so far.
Thank you for your detailed explanation. I agree that the time-frame which I have used offers only very limited data, but that is the reason why I used it :) It's kind of a stress test.

I like your indicator overall. This was the only issue I immediately found. It seems your calculation creates signals which are similar to the Stochastic, which also overreacts at the same time on the monthly chart:

Stochastic %R

Maybe if you change your formula to be similar to momentum you would not get this kind of extreme value overshoot and instead a signal which is more similar to actual price action:

Momentum
ChartArt
Same algorithm, no filter. I can add the option to show a filtered / non filtered output.
ChartArt
Another option is to reduce the length value.
Yes, I think the simple option to enable (or disable) the Ehlers smoothing is a good idea. The original signal looks good and not too noisy without it. Much cleaner than Stochastics (%R).
ChartArt
Thank you for your feedback. I do appreciate that.
United States
United Kingdom
India
España
France
Italia
Polska
Brasil
Россия
Türkiye
Indonesia

한국
Home Stock Screener Forex Signal Finder Economic Calendar How It Works Chart Features House Rules Moderators For the WEB Widgets Stock Charting Library Priority Support Feature Request Blog & News FAQ Help & Wiki Twitter