StefanReich

Pullback Analyzer

StefanReich Zaktualizowano   
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.
Informacje o Wersji:
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.
Informacje o Wersji:
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.
Informacje o Wersji:
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.

Skrypt open-source

Zgodnie z prawdziwym duchem TradingView, autor tego skryptu opublikował go jako open-source, aby traderzy mogli go zrozumieć i zweryfikować. Brawo dla autora! Możesz używać go za darmo, ale ponowne wykorzystanie tego kodu w publikacji jest regulowane przez Dobre Praktyki. Możesz go oznaczyć jako ulubione, aby użyć go na wykresie.

Wyłączenie odpowiedzialności

Informacje i publikacje przygotowane przez TradingView lub jego użytkowników, prezentowane na tej stronie, nie stanowią rekomendacji ani porad handlowych, inwestycyjnych i finansowych i nie powinny być w ten sposób traktowane ani wykorzystywane. Więcej informacji na ten temat znajdziesz w naszym Regulaminie.

Chcesz użyć tego skryptu na wykresie?