OPEN-SOURCE SCRIPT

RSX-D [ID: AC-P]

The "AC-P" version of Jaggedsoft's RSX Divergence and Everget's RSX script is my personal customized version of RSX with the following additions and modifications:
  • LSMA-D line that averages in three LSMA components to form a composite, the LSMA-D line. Offset for the LSMA-D line is set to -2 to offset latency from averaging togther the LSMA components to form a composite - recommended to adjust to your timeframe and asset/pair accordingly.
  • Divergence component from JustUncle, RicardoSantos, and Neobutane divergence scripts
  • Crossover indication and alerts for Midline, and custom M1 and M2 levels for both RSX and the LSMA-D line from Daveatt's CCI Stochastic Script
  • EMA21/55 zone cross highlighting option
  • SMA9/EMA45 MA option from my RSI sma/ema Cu script
  • Libertus Divergences and Pivot labels from Jaggedsoft's RSX Divergence script are hidden/off by default
  • Designed for darkmode by default. Minor visual changes from Jaggedsoft's and Everget's script(s) for darkmode and visual aesthetic.


Please Note:

  • Divergences that use fractal-based detection logic, offset, or a combination of both generally have a 1-2 bar/candle lag. This is an INHERENT limitation of divergence detection with fractals and offsets. Divergences generally will have a higher strikerate on HTF than LTF due to the 1-2 bar lag. While I'm not going to rule out a programming solution or math construct/formula that attempts to alleivates the 1-2 bar lag for divergences, this script is not it - please keep that in mind when using divergence components with a fractal base and offset.

  • LSMA-D is a composite of three LSMA lines, all with offset options. Different lengths and Offset values can compensate/adjust for the smoothing/latency from RSX, but only up to a certain point. For each LSMA, the least square regression line is calculated for the previous time periods, so the idea is that with finely tuned adjustments, you can get crossover/crossunder signals from the RSX with the LSMA-D line that you simply can't get with the SMA9/EMA45 due to the already smoothed RSX.


  • The defaults for the RSX and various components for the LSMA-D here will MOSTLY LIKELY NOT WORK OR BE APPLICABLE to every timeframe and asset that you trade - adjust, backtest, and test accordingly. The defaults are here are MEANT to be adjusted to the asset class and timeframe that you are trading.


  • If you're not familiar with the LSMA, tradingview author Alexgrover has a few great scripts that go into detail how the LSMA works, in addition to different interpretations and implementations of the LSMA.


References/Acknowledgements:

//version=4
// Copyright (c) 2019-present, Alex Orekhov (everget)
// Jurik RSX script may be freely distributed under the MIT license.
//
Jurik RSX


//-------------------------------------------------------------------
// Acknowledgements:
//---- Base script:
// RSX Divergence — SharkCIA by Jaggedsoft
//
RSX Divergence — SharkCIA

// Jurik Moving Average by Everget
//
Jurik Moving Average


//---- Divergences/Signals:
// Libertus RSI Divergences
//
Relative Strength Index - Divergences - Libertus

// Price Divergence Dectector V3 by JustUncle
//
Price Divergence Detector V3 revised by JustUncleL

// Price Divergence Detector V2 by RicardoSantos
//
[RS]Price Divergence Detector V2

// Stochastic RSI with Divergences by Neobutane
//
Stochastic RSI with Divergences

// CCI Stochastic by Daveatt
//
CCI Stochastic and a quick lesson on Scalping & Trading Systems


//---- Misc. Reference:
// RSI SMA/EMA Cu by Auroagwei
//
rsi sma/ema cu

// CBCI Cu by Auroagwei
//
cbci cu

// Chop and explode by fhenry0331
//
Chop and explode

// T-Step LSMA by RafaelZioni
//
T-Step LSMA VPT

// Scripts by Jaggedsoft for structure and formatting
// Scripts by Everget for structure and formatting

//-------------------------------------------------------------------
// RSX-D [ID: AC-P] v08
// Author: Auroagwei
// tradingview.com/u/auroagwei/
//-------------------------------------------------------------------
Average Directional Index (ADX)divergencesDIVShybridLeast Squares Moving Average (LSMA)midlineRelative Strength Index (RSI)RSX

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?

Disclaimer