This is a partial conversion of the original indicator from TradingView called UCS_Extreme Snap Back (TVI) V2. The original version includes three (3) different types of signals: low, medium, and high probability setup. To avoid adding too many signals on the chart, I have decided only to include the high probability trade setup (from the source code).
I think this could be useful for your current trading strategy.
Due to some requests, I have added the additional signals below. The following snippet will add low and medium reversal signals to your chart. All you have to do is paste the following code to the end of your script (from above).
Alternatively, you can also use @tomsk modified script below which includes all 3 signals into one script with the option to select which type of signal to display on the chart.
I think this could be useful for your current trading strategy.
thinkScript Code
Code:
# High Probability Setup
# Assembled by BenTen at useThinkScript.com
# Converted from https://www.tradingview.com/script/n3o7yet7-UCS-Extreme-Snap-Back-TVI-V2/
input src = ohlc4;
input len1 = 7;
input len2 = 14;
input len3 = 21;
def tr = Max(close[1], high) - Min(close[1], low);
# Moving Average (Mid Point Fair Value)
def ma1 = simplemovingavg(src, len1);
def ma2 = simplemovingavg(src, len2);
def ma3 = simplemovingavg(src, len3);
# ATR (Dynamic Volatility Units)
def rng1 = simplemovingavg(tr, len1);
def rng2 = simplemovingavg(tr, len2);
def rng3 = simplemovingavg(tr, len3);
# ATR deviation or Secret Sauce of the promoter
def up1 = ma1 + rng1 * 1.6;
def up2 = ma2 + rng2 * 2.4;
def up3 = ma2 + rng3 * 3.2;
def dn1 = ma1 - rng1 * 1.6;
def dn2 = ma2 - rng2 * 2.4;
def dn3 = ma2 - rng2 * 3.2;
def ERhigh3 = high > up1 and high > up2 and high > up3;
def ERlow3 = low < dn1 and low<dn2 and low<dn3;
def HiPERh = if ERhigh3[1] != 1 and ERhigh3 then 1 else 0;
def HiPERl = if ERlow3[1] != 1 and ERlow3 then 1 else 0;
#assignPriceColor(if HiPERh then color.red else if HiPERl then color.green else color.white);
# Plot Signals
plot bullish = HiPERl;
bullish.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_UP);
bullish.SetDefaultColor(Color.CYAN);
bullish.SetLineWeight(1);
plot bearish = HiPERh;
bearish.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_DOWN);
bearish.SetDefaultColor(Color.MAGENTA);
bearish.SetLineWeight(1);
Due to some requests, I have added the additional signals below. The following snippet will add low and medium reversal signals to your chart. All you have to do is paste the following code to the end of your script (from above).
Code:
## Low Probability Trade Setup
def ERhigh1 = if high > up1 then 1 else 0;
def ERlow1 = if low <dn1 then 1 else 0;
## Medium Probability Trade Setup
def ERhigh2 = if high > up1 and high > up2 then 1 else 0;
def ERlow2 = if low < dn1 and low<dn2 then 1 else 0;
def MiPERh = ERhigh2[1] != 1 and ERhigh2;
def MiPERl = ERlow2[1] != 1 and ERlow2;
def LoPERh = ERhigh1[1] != 1 and ERhigh1;
def LoPERl = ERlow1[1] != 1 and ERlow1;
# Plot Extra Signals
plot low_bullish = LoPERl;
low_bullish.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_UP);
low_bullish.SetDefaultColor(Color.CYAN);
low_bullish.SetLineWeight(1);
plot low_bearish = LoPERh;
low_bearish.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_DOWN);
low_bearish.SetDefaultColor(Color.MAGENTA);
low_bearish.SetLineWeight(1);
plot medium_bullish = MiPERl;
medium_bullish.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_UP);
medium_bullish.SetDefaultColor(Color.CYAN);
medium_bullish.SetLineWeight(1);
plot medium_bearish = MiPERh;
medium_bearish.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_DOWN);
medium_bearish.SetDefaultColor(Color.MAGENTA);
medium_bearish.SetLineWeight(1);
Alternatively, you can also use @tomsk modified script below which includes all 3 signals into one script with the option to select which type of signal to display on the chart.
Last edited: