OPEN-SOURCE SCRIPT

WhipLash

Updated
This is a study to determine if small candle bodies (little difference between open and close), regardless of overall candle length (high/low), can be used to filter choppy markets.

The indicator will calculate the selected average "MA Mode" of (close-open). To standardize this result and ensure any filters/thresholds do not need to be recalculated for each instrument the result will be used to calculate the Z Score.

The idea is that when candle bodies are small there is very little actual price movement, and therefore price is choppy. When considering the Z Score of that result, any outliers ie larger candle bodies, could show a potential trend forming. This indicator is similar to QStick but allows more customization by the user.

MA Mode determines which MA is used to smooth the results of (close-open)

Price Smoothing is the number of running periods the MA Mode is calculated for.

The three Thresholds are preset to the 90%, 95%, and 99% levels for Z Score. If these thresholds are altered you may wish to also alter the horizontal lines programmed for each level on the positive and negative sides.

The Z Length is the period for which the Z Score is calculated

Multiple MA Options Credits to Fractured
Bits and Pieces from alexgrover, montyjus, and jiehonglim

As always, trade at your own risk.
Release Notes
Added alerts programming. There are now six built in alert functions. Three LONG alerts, and three SHORT alerts that are based on price breaching a threshold level. These threshold levels correspond to the threshold levels built into the script.

Threshold 1 will alert if price breaches Threshold 1 but not Threshold 2
Threshold 2 will alert if price breaches Threshold 2 but not Threshold 3
Threshold 3 will alert if price is greater than Threshold 3

You may program these for LONG and SHORT price movements. Note: you MUST set the Threshold levels PRIOR to setting the alert.

Strongly recommend selecting "ONCE PER BAR CLOSE" as price may move the indicator while the candle is open above or below the threshold as the calculation is based on CLOSE price.

You will likely receive a "REPAINTER" alert. After reviewing the PineScript repainter information this is likely due to the fact EMAs are used within the calculation. I have not noticed the indicator changing previously recorded data EXCEPT for the OPEN candle (which is normal when close price is utilized).

Utilize all 6 or 1, whatever works best for your system.

As always, trade at your own risk.
Release Notes
No changes to code simply republishing as I forgot to update the chart view prior to most recent update.
Release Notes
Added alert conditions for indicator crossing zero by request. This can be used to prepare for an entry, or used as an exit for an open trade.

This script has not been optimized for all instruments. You will want to find the best settings for your needs.

Alert information is included in previous update regarding how to program.

As always, trade at your own risk.
Centered OscillatorsCHOPChoppiness Index (CHOP)nnfxQstick IndicatorStandard DeviationstandardizationtrendtrendtradingVolatilityz-scorezscore

Open-source script

In true TradingView spirit, the author of this script has published it open-source, so traders can understand and verify it. Cheers to the author! You may use it for free, but reuse of this code in publication is governed by House rules. You can favorite it to use it on a chart.

Want to use this script on a chart?


Also on:

Disclaimer