This tool uses past market data to attempt to identify where changes in “memory” may occur to spot reversals. The Hurst Exponent was a big inspiration for this code. The main driver is identifying when past ranges expand and contract, leading to a change in direction. With the use of Sum of Squared Errors, users do not need to input anything.

Getting optimized parameters



The N_range list encompasses every lookback value to check with. The sse_calc function accepts an individual element to then perform the calculation for Reversals. If there is a reversal, the error becomes how far away the close is from a moving average with that look back. Lowest error wins. That would be the look back used for the Reversals calculation.

Reversals calculation



X_opt and y_opt are the compared values to develop the system. Everything done afterwards is scaling and using it to spot the Reversals. X_opt is the current close, minus the close with the optimal N bars back, squared. Then y_opt is also that but plus the current close squared. Z_opt is then x_opt / y_opt. This gives us a pretty small number that will go up when we approach tops or bottoms. To make life a little easier I normalize the value between 0 and 1.

After I find the moving average with the optimal N, I can check if there is a Reversal. Reversals are there when the last value is at 1 and the current value drops below 0.90. This would tell us that “memory” was strong and is now changing. To determine direction and help with accuracy, if the close is above the moving average it is a bearish alert, and vice versa. As well as the close must be below the last low for a bearish Reversal, above the last high for a bullish Reversal. Also the close must be above the open for a bullish Reversal, and below for a bearish one.

Visual examples

スナップショット

This TSLA chart shows how alerts may come around. The bullish and bearish labels are plotted on the chart along with a reference line to see price interact with.

スナップショット

The indicator has the potential to be inactive, like we see here on OKLO. There is only one alert, and it marks the bottom nicely.

スナップショット

Stocks with strong trends like NOW may be more susceptible to false alerts. Assets that are volatile and bounce around a lot may be better.

スナップショット

It works on intra day charts the same as on Daily or longer charts. We see here on QQQ it spotted the bottom on this particular trading day.

This tool is meant to aid traders in making decisions, not to be followed blindly. No trading tool is 100% accurate and Sum of Squared Errors does not guarantee the most optimal value. I encourage feedback and constructive criticism.
Candlestick analysisChart patterns

オープンソーススクリプト

TradingViewの精神に則り、このスクリプトの作者は、トレーダーが理解し検証できるようにオープンソースで公開しています。作者に敬意を表します!無料で使用することができますが、このコードを投稿で再利用するには、ハウスルールに準拠する必要があります。 お気に入りに登録してチャート上でご利用頂けます。

チャートでこのスクリプトを利用したいですか?


他のメディア:

免責事項