StefanReich

Pullback Analyzer

StefanReich アップデート済   
Pullback Analyzer - a trailing stop helper.

This indicator measures the biggest pullback encountered during an up or down move.
You can use the reported percentages to fine-tune your trailing stop.

The reporting is very precise: On higher timeframes, the pullback size can sometimes not be determined exactly from the candles.
In this case, the script displays a lower and upper bound for this number.
I suggest that you use the upper bound as your trailing stop callback rate (plus some safety margin if you like).

The size of the move itself is always reported as a lower bound.

The biggest pullback within each move is marked with a gray dotted line.

There is only one parameter, "lookback"' (or lookback limit), which determines how many bars a single move can comprise. A value of 50 was found to be a nice default. If you lower the lookback, long moves will be split up into multiple moves, each being at or below the lookback limit. Conversely, you can capture longer moves in one piece by raising the lookback limit.

The algorithm automatically ignores small moves and trading ranges near a bigger move. (We may add a parameter to control this behavior more precisely in the future.)

How the algorithm works

There is a central class called MoveFinder which scans the candle feed for the biggest possible move in a certain direction (up or down).

Two instances of this class are used, one for each direction, to find the biggest next up and down move simultaneously (upFinder and downFinder).

Additionally, each of these main MoveFinders contains two more MoveFinders. These are used to find pullbacks within the move. (This comes from the observation that finding a pullback is fundamentally the exact same operation as finding a move, just with opposing direction and limited to the time between the move's beginning and end.)

Why two nested MoveFinders per parent (for a total of 6 in the program)? Well, one of them runs in "lower bound" and one runs in "upper bound" mode, so we can print the detected pullback size as an exact interval (lower bound <= real pullback <= upper bound). I am a mathematician. I like precision.

Moves as well as pullbacks that have been found are stored as instances of class Move which simply stores start and end bar index as well as start and end price.
リリースノート:
Fixed a bug in the script that sometimes showed a wrong pullback value. Changed increment for lookback value to 10 which I think is more practical.
リリースノート:
Added a "forex mode", i.e. an option to show percentages as pips. :) Selecting this mode also improves the label placement for low volatility assets such as forex pairs.
リリースノート:
Added an option to show move sizes in points. Added an option to not show pullbacks. Added an option to show beginning and end price of each move.

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

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

免責事項

これらの情報および投稿は、TradingViewが提供または保証する金融、投資、取引、またはその他の種類のアドバイスや推奨を意図したものではなく、またそのようなものでもありません。詳しくは利用規約をご覧ください。

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