KevinLemur

KLemurs Deviation

KevinLemur Updated   
Market: Stocks and ETF's

This overlay shows the deviation of the exponential moving average of the mid candle price of the currently loaded chart, away from the exponential moving average of the S&P and DOW combined and averaged mid candle price. The top and bottom lines also give a visual perspective of what a certain percentage (default 1%) looks like on the current charts window. This may help with making quick decisions for things like setting trailing stop trades with a percentage. This can be used for stocks, ETF's, and index's and It may be useful in finding potential stocks or ETF's if you are interested in these kinds of deviations. Defaults are set for a dark screen but can be edited to your taste. It's optimized to be an overlay on the current chart window as opposed to being a separate window.

Percentage Lines (editable)
This is three lines. The upper line (default green) plots the set percentage (default 1%) above the current chart’s ema. The middle line (default white) plots the current chart’s ema. The lower line (default red) plots the set percentage (default 1%) below the current chart’s ema.

Deviation Band (editable)
This is the colored band on the overlay between the upper and lower percentage lines. The band’s fill color indicates the deviation of the current charts ema from the ema of the combined S&P and DOW’s ema as follows:


- Red (default) = Current Chart’s ema is descending and the S&P/DOW ema is descending OR the Current Chart’s ema is below (underperforming) the S&P/DOW ema.

- Orange (default) = The Current Chart and S&P/DOW ema’s are both either ascending or descending together.

- Green (default) = The Current Chart’s ema is ascending but the S&P/DOW ema is descending.


To Set Line Colors
BY default, the upper line color uses the same colors as the ascending band color and the lower line uses the same color as the descending band color. To set the line colors, see "plotColor", "plotColorUp", or" plotColorDown" in variable settings within the script or use the “Central Plot Line”, “Upper Plot Line, or “Lower Plot Line” in the input dialogue to change this.

To Set Band Colors
To set the band colors, see "plotColor", "plotColorUp", or "plotColorDown" in variable settings within the script or use the “Color0”, “Color1", or “Color2” in the input dialogue to change this.

To Set EMA Lookback Period
The ema lookback period defaults to 5. This is the number of candles back that the script will use to determine the ema. See “CCemaN” in variable settings within the script or use the “EMA Period” in the input dialogue to change this.

To Set Percentage
To set the percentage that plots the upper and lower lines, see "CCP" in variable settings within the script or use “Upper/Lower Bands Percentage” in the input dialogue to change this. The default is .01 (or 1%).




Release Notes:
Changed the period of the remote charts data from "5" to "timeframe.period". This will mean the data pulled from the remote chart (S&P and DOW) will now be at the same period as the current chart instead of the default "5".
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 a publication is governed by House Rules. You can favorite it to use it on a chart.

Disclaimer

The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.

Want to use this script on a chart?