The One Renko To Rule Them All For ThinkOrSwim

samer800

Moderator - Expert
VIP
Lifetime
hello group! i will like to have this awesome indicator convert into TOS, the only link for this indicator is a google drive, here is the video with the links.




//@version=4
//
// =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= THE ONE RENKO TO RULE THEM ALL =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
// Designed to be used on Renko 1s, Traditional 4. I primary trade the US 100 PEPPERSTONE (which is NQ futures)
// Version 1 created by TraderOracle 11/18/2023
// Version 1.1 - Fixed flag and squeeze overlapping, plus changed colors to be more intuitive
//
study(title="The One Renko To Rule Them All", overlay=true, shorttitle="The One Renko 1.1")
bShowFlags = input(false, title="Show Flags", group="Main Settings")
bShowDots = input(false, title="Show Dots", group="Main Settings")
bShowX = input(true, title="Show Big X for Buy/Sell", group="Main Settings")
bUseDeadSimple = input(false, title="Use Dead Simple Reversal", group="Main Settings")
bUpCurve = close > close[1] and close[1] > close[2] and close[2] > close[3] and close[3] < close[4] and close[4] < close[5] and close[5] < close[6] ? 1 : 0
bDownCurve = close < close[1] and close[1] < close[2] and close[2] < close[3] and close[3] > close[4] and close[4] > close[5] and close[5] > close[6] ? 1 : 0
//
// =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= ULTIMATE REVERSAL 1.22 =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
// These are volume patterns I noticed after backtesting reversals for many months
//
var cColor = color.rgb(194, 196, 197)
basis = sma(close, 30)
dev = 2 * stdev(close, 30)
upper = basis + dev
lower = basis - dev
is0Green = close > open
is1Green = close[1] > open[1]
is2Green = close[2] > open[2]
is3Green = close[3] > open[3]
is4Green = close[4] > open[4]
is0Red = not is0Green
is1Red = not is1Green
is2Red = not is2Green
is3Red = not is3Green
is4Red = not is4Green
// Pattern #1 - small red bar, larger red bar, small green bar
up1 = (volume[1] > volume[2] and volume < volume[1] and is0Green and is1Red and is2Red)
down1 = (volume[1] > volume[2] and volume < volume[1] and is0Red and is1Green and is2Green)
// Pattern #2 - small red bar, larger red bar, even LARGER red bar, small green bar
up2 = (volume[2] > volume[3] and volume[3] > volume[4] and volume[1] < volume[2] and volume < volume[2] and is0Green and is1Red and is2Red and is3Red and is4Red)
down2 = (volume[2] > volume[3] and volume[3] > volume[4] and volume[1] < volume[2] and volume < volume[2] and is0Red and is1Green and is2Green and is3Green and is4Green)
// Pattern #3 - 4 bars of the same color, then a different color bar that's larger than all 4 previous
up3 = (is1Red and is2Red and is3Red and is4Red and is0Green and volume > volume[1] and volume > volume[2] and volume > volume[3] and volume > volume[4])
down3 = (is1Green and is2Green and is3Green and is4Green and is0Red and volume > volume[1] and volume > volume[2] and volume > volume[3] and volume > volume[4])
// snippet from Candlestick Reversal System by LonesomeTheDove
pivotlbar = 5
highleftempty = pivothigh(pivotlbar, 0)
lowleftempty = pivotlow(pivotlbar, 0)
wick_multiplier = 10
body_percentage = 1
O = open
C = close
H = high
L = low
Wlongsignal = (C > O) and (O - L) >= ((C - O) * wick_multiplier) and (H - C) <= ((H - L) * body_percentage) or
(C < O) and (C - L) >= ((O - C) * wick_multiplier) and (H - C) <= ((H - L) * body_percentage) or
(C == O and C != H) and (H - L) >= ((H - C) * wick_multiplier) and (H - C) <= ((H - L) * body_percentage) or
(O == H and C == H) and (H - L) >= sma((H - L), 50)
Wshortsignal = (C < O) and (H - O) >= ((O - C) * wick_multiplier) and (C - L) <= ((H - L) * body_percentage) or
(C > O) and (H - C) >= ((C - O) * wick_multiplier) and (C - L) <= ((H -L) * body_percentage) or
(C == O and C != L) and (H - L) >= ((C - L) * wick_multiplier) and (C - L) <= ((H - L) * body_percentage) or
(O == L and C == L) and (H - L) >= sma((H - L), 50)
// Candlestick pattern is technically Pattern #4
up4 = lowleftempty and Wlongsignal
down4 = highleftempty and Wshortsignal
upsie1 = rma(max(change(close), 0), 14)
downsie1 = rma(-min(change(close), 0), 14)
MyRsi = downsie1 == 0 ? 100 : upsie1 == 0 ? 0 : 100 - (100 / (1 + upsie1 / downsie1))
BollingerCross = false
up99 = (up1 or up2 or up3 or up4)
down99 = (down1 or down2 or down3 or down4)
bColor = color.rgb(199, 197, 197)
if (MyRsi < 60)
down99 := false
if (MyRsi > 40)
up99 := false
// version 1.21 - I wasn't showing Bollinger Bands/RSI unless it also was volume rules, which kinda ruins the point of the update. Fixed...
if (close < (lower - 2) or (lower - 2) and MyRsi < 30)
bColor := color.rgb(255, 53, 53)
up99 := true
if (close > (upper + 2) or open > (upper + 2) and MyRsi > 80)
bColor := color.rgb(255, 53, 53)
down99 := true
// eliminate dupes
if (up99[1])
up99 := false
if (down99[1])
down99 := false
atr = atr(10)
pos2 = high + (1.6 * atr)
pos3 = low - (1.6 * atr)
// My implementation of DEAD SIMPLE REVERSAL from PaidToFade
q1 = close[1] < open[1] and close > open
q2 = close > open[1]
q3 = lowest(low,3) < lowest (low,50)[1] or lowest(low,3) < lowest(low,50)[2] or lowest(low,3) < lowest(low,50)[3]
buyme = q1 and q2 and q3
q4 = close[1] > open[1] and close < open
q5 = close < open[1]
q6 = highest(high,3) > highest (high,50)[1] or highest(high,3) > highest(high,50)[2] or highest(high,3) > highest(high,50)[3]
sellme = q4 and q5 and q6
if (buyme and bUseDeadSimple)
bColor := color.lime
//up99 := true
if (sellme and bUseDeadSimple)
bColor := color.lime
//down99 := true
plotshape(down99 and bShowFlags ? pos2 : na, title="Reversal Sell Signal", style=shape.flag, location=location.absolute, color=bColor, size=size.tiny)
plotshape(up99 and bShowFlags ? pos3 : na, title="Reversal Buy Signal", style=shape.flag, location=location.absolute, color=bColor, size=size.tiny)

//
// =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= SQUEEZE MOMENTUM RELAXER 2.1 =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
// This is an improper use of TTM Squeeze. I capture the shift between a squeeze condition, and a relaxed condition
//
var cGreen = 0
var cRed = 0
var pos = false
var neg = false
// Keltner Channel
esma(close, length)=>
s = sma(close, 20)
e = ema(close, 20)
true ? e : s
ma1 = esma(close, 20)
rangema1 = atr(10)
upper1 = ma1 + rangema1 * 2
lower1 = ma1 - rangema1 * 2
KeltnerCross = crossover(close, upper1) or crossover(close, lower1)
// ADX
upq4 = rma(max(change(close), 0), 14)
downq4 = rma(-min(change(close), 0), 14)
rsi = downq4 == 0 ? 100 : upq4 == 0 ? 0 : 100 - (100 / (1 + upq4 / downq4))
dirmov(len) =>
up = change(high)
down = -change(low)
plusDM = na(up) ? na : (up > down and up > 0 ? up : 0)
minusDM = na(down) ? na : (down > up and down > 0 ? down : 0)
truerange = rma(tr, len)
plus = fixnan(100 * rma(plusDM, len) / truerange)
minus = fixnan(100 * rma(minusDM, len) / truerange)
[plus, minus]
adx(dilen, adxlen) =>
[plus, minus] = dirmov(dilen)
sum = plus + minus
adx = 100 * rma(abs(plus - minus) / (sum == 0 ? 1 : sum), adxlen)
sig = adx(14, 14) // ADX DI Length = 14, ADX Length. = 14
sigabove11 = sig > 11 // ADX Value = 11
// WAE Dead Zone
calc_macd(source, fastLength, slowLength) =>
fastMA = ema(source, fastLength)
slowMA = ema(source, slowLength)
fastMA - slowMA
t1 = (calc_macd(close, 20, 40) - calc_macd(close[1], 20, 40))*150
t2 = (calc_macd(close[2], 20, 40) - calc_macd(close[3], 20, 40))*150
trendUp = (t1 >= 0) ? t1 : 0
trendDown = (t1 < 0) ? (-1*t1) : 0
// Squeeze Momentum
useTrueRange = true
source = close
basis5 = sma(close, 20)
dev1 = 1.5 * stdev(close, 20)
upperBB = basis5 + dev1
lowerBB = basis5 - dev1
ma = sma(close, 20)
rangeQ = useTrueRange ? tr : (high - low)
rangema = sma(rangeQ, 20)
upperKC = ma + rangema * 1.5
lowerKC = ma - rangema * 1.5
sqzOn = (lowerBB > lowerKC) and (upperBB < upperKC)
sqzOff = (lowerBB < lowerKC) and (upperBB > upperKC)
noSqz = (sqzOn == false) and (sqzOff == false)
// Had to change this from the original
avg1 = avg(highest(high, 20), lowest(low, 20))
avg2 = avg(avg1, sma(close, 20))
val = linreg(close - avg2, 20, 0)
pos := false
neg := false
// if squeeze is bright RED, increment by one
if (val < nz(val[1]) and val < 5 and not sqzOn)
cRed := cRed + 1
// if squeeze is bright GREEN, increment by one
if (val > nz(val[1]) and val > 5 and not sqzOn)
cGreen := cGreen + 1
// if bright RED squeeze is now dim, momentum has changed. Is ADX also above 11? - add a marker to chart
if (val > nz(val[1]) and cRed > 1 and val < 5 and not pos[1] and sigabove11 == true)
cRed := 0
pos := true
// if bright GREEN squeeze is now dim, momentum has changed. Is ADX also above 11? - add a marker to chart
if (val < nz(val[1]) and cGreen > 1 and val > 5 and not neg[1] and sigabove11 == true)
cGreen := 0
neg := true
buySignal1 = pos
sellSignal1 = neg
// Basic diamond color: Yellow as default, and Red is RSI is overbought or sold
bColor4 = iff(rsi < 34 or rsi > 66, color.rgb(255, 0, 0), color.rgb(189, 189, 189)) // RSI Overbought Value = 34, RSI Oversold Value = 66
// If we crossed Keltner channel, then color is Aqua
// cColor4 = iff(KeltnerCross, color.rgb(50, 255, 67), bColor4)
cColor4 = bColor4
plotshape(buySignal1 and bShowDots ? pos : na, title="Squeeze Buy Signal", style=shape.diamond, location=location.belowbar, color=cColor4, size=size.tiny)
plotshape(sellSignal1 and bShowDots ? neg : na, title="Squeeze Sell Signal", style=shape.diamond, location=location.abovebar, color=cColor, size=size.tiny)
// BUY SELL SIGNALS
//buySignals = 0
//for history1 = 0 to iLookBack - 1
// if (buySignal1[history1])
// buySignals := buySignals + 1
//sellSignals = 0
//for history1 = 0 to iLookBack - 1
// if (sellSignals[history1])
// sellSignals := sellSignals + 1
//upSignals = 0
//for history1 = 0 to iLookBack - 1
// if (up99[history1])
// upSignals := upSignals + 1
//downSignals = 0
//for history1 = 0 to iLookBack - 1
// if (downSignals[history1])
// down99 := downSignals + 1
bBuyFlag = buySignal1 or buySignal1[1] or buySignal1[2] or buySignal1[3] or buySignal1[4] or buySignal1[5] or buySignal1[6]
bBuySqueeze = up99 or up99[1] or up99[2] or up99[3] or up99[4] or up99[5] or up99[6]
bSellFlag = sellSignal1 or sellSignal1[1] or sellSignal1[2] or sellSignal1[3] or sellSignal1[4] or sellSignal1[5] or sellSignal1[6]
bSellSqueeze = down99 or down99[1] or down99[2] or down99[3] or down99[4] or down99[5] or down99[6]
plotshape(bUpCurve and bBuyFlag and bBuySqueeze and bShowX ? 1 : na, title="X Buy Signal", location=location.belowbar, style=shape.xcross, size=size.normal, color=color.rgb(11, 255, 141))
plotshape(bDownCurve and bSellFlag and bSellSqueeze and bShowX ? 1 : na, title="X Sell Signal", location=location.abovebar, style=shape.xcross, size=size.normal, color=color.rgb(255, 12, 12))
alertcondition(bUpCurve, title='One Renko BUY', message='One Renko BUY')
alertcondition(bDownCurve, title='One Renko SELL', message='One Renko SELL')

//
// =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= RENKO INTENSITY =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
// TBD
//

@samer800 please take a look when you get a change please, this look really good for day trading on 2000 tick charts. thank you in advance!

@samer800 hopelly you can help us to get this indicator in TOS, thanks in advance!
check the below

CSS:
#// =-= THE ONE RENKO TO RULE THEM ALL =
#// Designed to be used on Renko 1s, Traditional 4. I primary trade the US 100 PEPPERSTONE (which is NQ futures)
#// Version 1 created by TraderOracle 11/18/2023
#// Version 1.1 - Fixed flag and squeeze overlapping, plus changed colors to be more intuitive
#study(title="The One Renko To Rule Them All", overlay=true, shorttitle="The One Renko 1.1")
# Converted by Sam4Cok@Samer800    - 12/2023

input showReversalSignals = no;        # "Show Flags"
input showSqueezeSignals = no;         # "Show Dots"
input showBuySellSignals = yes;        # "Show Big X for Buy/Sell"
input UseDeadSimpleReversal = no;      # "Use Dead Simple Reversal"

def na = Double.NaN;

def bUpCurve = close > close[1] and close[1] > close[2] and close[2] > close[3] and close[3] < close[4] and close[4] < close[5] and close[5] < close[6];# ? 1 : 0;
def bDownCurve = close < close[1] and close[1] < close[2] and close[2] < close[3] and close[3] > close[4] and close[4] > close[5] and close[5] > close[6];# ? 1 : 0

#//  ULTIMATE REVERSAL 1.22 =-=-=-=-=-=-=-=-=-
#// These are volume patterns I noticed after backtesting reversals for many months

DefineGlobalColor("cColor", CreateColor(194, 196, 197));
DefineGlobalColor("b1Color", CreateColor(199, 197, 197));
DefineGlobalColor("b0Color", CreateColor(255, 53, 53));

def basis = Average(close, 30);
def dev = 2 * StDev(close, 30);
def upper = basis + dev;
def lower = basis - dev;
def is0Green = close > open;
def is1Green = close[1] > open[1];
def is2Green = close[2] > open[2];
def is3Green = close[3] > open[3];
def is4Green = close[4] > open[4];
def is0Red = !is0Green;
def is1Red = !is1Green;
def is2Red = !is2Green;
def is3Red = !is3Green;
def is4Red = !is4Green;
#// Pattern #1 - small red bar, larger red bar, small green bar
def up1 = (volume[1] > volume[2] and volume < volume[1] and is0Green and is1Red and is2Red);
def down1 = (volume[1] > volume[2] and volume < volume[1] and is0Red and is1Green and is2Green);
#// Pattern #2 - small red bar, larger red bar, even LARGER red bar, small green bar
def up2 = (volume[2] > volume[3] and volume[3] > volume[4] and volume[1] < volume[2] and volume < volume[2] and is0Green and is1Red and is2Red and is3Red and is4Red);
def down2 = (volume[2] > volume[3] and volume[3] > volume[4] and volume[1] < volume[2] and volume < volume[2] and is0Red and is1Green and is2Green and is3Green and is4Green);
#// Pattern #3 - 4 bars of the same color, then a different color bar that's larger than all 4 previous
def up3 = (is1Red and is2Red and is3Red and is4Red and is0Green and volume > volume[1] and volume > volume[2] and volume > volume[3] and volume > volume[4]);
def down3 = (is1Green and is2Green and is3Green and is4Green and is0Red and volume > volume[1] and volume > volume[2] and volume > volume[3] and volume > volume[4]);
#// snippet from Candlestick Reversal System by LonesomeTheDove
script FindPivots {
    input dat = close; # default data or study being evaluated
    input HL  = 0;    # default high or low pivot designation, -1 low, +1 high
    input lbL  = 5;    # default Pivot Lookback Left
    input lbR  = 1;    # default Pivot Lookback Right
    ##############
    def _nan;    # used for non-number returns
    def _BN;     # the current barnumber
    def _VStop;  # confirms that the lookforward period continues the pivot trend
    def _V;      # the Value at the actual pivot point
    def _pivotRange;
    ##############
    _BN  = BarNumber();
    _nan = Double.NaN;
    _pivotRange = lbL + lbL;
    _VStop = if !IsNaN(dat[_pivotRange]) and lbR > 0 and lbL > 0 then
                fold a = 1 to lbR + 1 with b=1 while b do
                    if HL > 0 then dat > GetValue(dat, -a) else dat < GetValue(dat, -a) else _nan;
    if (HL > 0) {
        _V = if _BN > lbL and dat == Highest(dat, lbL + 1) and _VStop
            then dat else _nan;
    } else {
        _V = if _BN > lbL and dat == Lowest(dat, lbL + 1) and _VStop
            then dat else _nan;
    }
    plot result = if !IsNaN(_V) and _VStop then _V else _nan;
}
def pivotlbar = 5;
def highleftempty = findpivots(high, 1, pivotlbar, 0);
def lowleftempty  = findpivots(low - 1, pivotlbar, 0);
def wick_multiplier = 10;
def body_percentage = 1;
def O = open;
def C = close;
def H = high;
def L = low;
def Wlongsignal = (C > O) and (O - L) >= ((C - O) * wick_multiplier) and (H - C) <= ((H - L) * body_percentage) or
(C < O) and (C - L) >= ((O - C) * wick_multiplier) and (H - C) <= ((H - L) * body_percentage) or
(C == O and C != H) and (H - L) >= ((H - C) * wick_multiplier) and (H - C) <= ((H - L) * body_percentage) or
(O == H and C == H) and (H - L) >= Average((H - L), 50);
def Wshortsignal = (C < O) and (H - O) >= ((O - C) * wick_multiplier) and (C - L) <= ((H - L) * body_percentage) or
(C > O) and (H - C) >= ((C - O) * wick_multiplier) and (C - L) <= ((H - L) * body_percentage) or
(C == O and C != L) and (H - L) >= ((C - L) * wick_multiplier) and (C - L) <= ((H - L) * body_percentage) or
(O == L and C == L) and (H - L) >= Average((H - L), 50);

#// Candlestick pattern is technically Pattern #4
def up4 = !isNaN(lowleftempty) and Wlongsignal;
def down4 = !isNaN(highleftempty) and Wshortsignal;
def MyRsi = rsi(Price = close, Length = 14);

def up990 = (up1 or up2 or up3 or up4);
def down990 = (down1 or down2 or down3 or down4);
def bColor1;
def bColor = if (close < (lower - 2) or (lower - 2) and MyRsi < 30) then -1 else
             if (close > (upper + 2) or open > (upper + 2) and MyRsi > 80) then -1 else 0;
def down99 = if down99[1] then no else
             if (close > (upper + 2) or open > (upper + 2) and MyRsi > 80) then yes else
             if (MyRsi < 60) then no else down990;
def up99 = if up99[1] then no else
           if (close < (lower - 2) or (lower - 2) and MyRsi < 30) then yes else
           if (MyRsi > 40) then no else up990;

def atr = atr(Length = 10);
def pos2 = high + (1.1 * atr);
def pos3 = low  - (1.1 * atr);
#// My implementation of DEAD SIMPLE REVERSAL from PaidToFade
def q1 = close[1] < open[1] and close > open;
def q2 = close > open[1];
def q3 = Lowest(low, 3) < Lowest (low, 50)[1] or Lowest(low, 3) < Lowest(low, 50)[2] or Lowest(low, 3) < Lowest(low, 50)[3];
def buyme = q1 and q2 and q3;
def q4 = close[1] > open[1] and close < open;
def q5 = close < open[1];
def q6 = Highest(high, 3) > Highest (high, 50)[1] or Highest(high, 3) > Highest(high, 50)[2] or Highest(high, 3) > Highest(high, 50)[3];
def sellme = q4 and q5 and q6;

if (buyme and UseDeadSimpleReversal) {
    bColor1 = 1;
    } else
if (sellme and UseDeadSimpleReversal) {
    bColor1 = 1;
    } else {
    bColor1 = bColor;
}
plot RevSell = if down99 and showReversalSignals then pos2 else na; #"Reversal Sell Signal
RevSell.AssignValueColor(if bColor1 > 0 then Color.CYAN else
                         if bColor1 < 0 then Color.MAGENTA else color.WHITE);
RevSell.SetPaintingStrategy(PaintingStrategy.SQUARES);

plot RevBuy = if up99 and showReversalSignals then pos3 else na; # "Reversal Buy Signal
RevBuy.AssignValueColor(if bColor1 > 0 then Color.CYAN else
                        if bColor1 < 0 then Color.MAGENTA else color.WHITE);
RevBuy.SetPaintingStrategy(PaintingStrategy.SQUARES);

#// This is an improper use of TTM Squeeze.
#// Keltner Channel
def esma = ExpAverage(close, 20);
def ma1 = esma;
def rangema1 = atr(Length = 10);
def upper1 = ma1 + rangema1 * 2;
def lower1 = ma1 - rangema1 * 2;
def KeltnerCross = (close Crosses Above upper1) or (close Crosses Above lower1);
def sig = Reference adx();# // ADX DI Length = 14, ADX Length. = 14
def sigabove11 = sig > 11;# // ADX Value = 11
#// WAE Dead Zone
Script calc_macd {
input source = close;
input fastLength = 20;
input slowLength = 40;
    def fastMA = ExpAverage(source, fastLength);
    def slowMA = ExpAverage(source, slowLength);
    def calc_macd = fastMA - slowMA;
    plot out = calc_macd;
}
def t1 = (calc_macd(close, 20, 40) - calc_macd(close[1], 20, 40))*150;
def t2 = (calc_macd(close[2], 20, 40) - calc_macd(close[3], 20, 40))*150;
def trendUp = if (t1 >= 0) then t1 else 0;
def trendDown = if (t1 < 0) then (-1*t1) else 0;
#// Squeeze Momentum
def source = close;
def basis5 = Average(close, 20);
def dev1 = 1.5 * stdev(close, 20);
def upperBB = basis5 + dev1;
def lowerBB = basis5 - dev1;
def ma = Average(close, 20);
def tr = TrueRange(high, close, low);
def rangeQ = if !isNaN(tr) then tr else (high - low);
def rangema = Average(rangeQ, 20);
def upperKC = ma + rangema * 1.5;
def lowerKC = ma - rangema * 1.5;
def sqzOn = (lowerBB > lowerKC) and (upperBB < upperKC);
def sqzOff = (lowerBB < lowerKC) and (upperBB > upperKC);
def noSqz = (!sqzOn) and (!sqzOff);
#// Had to change this from the original
def avg1 = (highest(high, 20) + lowest(low, 20)) / 2;
def avg2 = (avg1 + Average(close, 20)) / 2;
def val = Inertia(close - avg2, 20);

def cGreen;# = 0
def cRed;# = 0
def pos;# = false
def neg;# = false

if (val < val[1] and cGreen[1] > 1 and val > 5 and !neg[2] and sigabove11) {
    cGreen = 0;
    neg = yes;
    cRed   = cRed[1];
    pos    = no;
    } else
if (val > val[1] and cRed[1] > 1 and val < 5 and !pos[2] and sigabove11) {
    cRed = 0;
    pos  = yes;
    cGreen = cGreen[1];
    neg    = neg[1];
    } else
if (val > val[1] and val > 5 and !sqzOn) {
    cGreen = cGreen[1] + 1;
    cRed   = cRed[1];
    pos    = no;#pos[1];
    neg    = no;#neg[1];
    } else
if (val < val[1] and val < 5 and !sqzOn) {
    cRed = cRed[1] + 1;
    cGreen = cGreen[1];
    pos    = no;#pos[1];
    neg    = no;#neg[1];
    } else {
    cGreen = cGreen[1];
    cRed   = cRed[1];
    pos    = no;#pos[1];
    neg    = no;#neg[1];
}
def buySignal1 = pos;
def sellSignal1 = neg;
#// Basic diamond color: Yellow as default, and Red is RSI is overbought or sold
def bColor4 = if(myrsi < 34 or myrsi > 66, -1, 0);

plot sqBuy = if buySignal1 and showSqueezeSignals then pos else na;#, title="Squeeze Buy Signal"
plot sqSell = if sellSignal1 and showSqueezeSignals then neg else na;#, title="Squeeze Sell Signal"

sqBuy.SetPaintingStrategy(PaintingStrategy.BOOLEAN_WEDGE_DOWN);
sqBuy.AssignValueColor(if bColor4 < 0 then Color.RED else CreateColor(189, 189, 189));
sqSell.SetPaintingStrategy(PaintingStrategy.BOOLEAN_WEDGE_UP);
sqSell.AssignValueColor(if bColor4 < 0 then Color.RED else CreateColor(189, 189, 189));

def bBuyFlag = buySignal1 or buySignal1[1] or buySignal1[2] or buySignal1[3] or buySignal1[4] or buySignal1[5] or buySignal1[6];
def bBuySqueeze = up99 or up99[1] or up99[2] or up99[3] or up99[4] or up99[5] or up99[6];
def bSellFlag = sellSignal1 or sellSignal1[1] or sellSignal1[2] or sellSignal1[3] or sellSignal1[4] or sellSignal1[5] or sellSignal1[6];
def bSellSqueeze = down99 or down99[1] or down99[2] or down99[3] or down99[4] or down99[5] or down99[6];

plot xBuy = if bUpCurve and bBuyFlag and bBuySqueeze and showBuySellSignals then 1 else na; # "X Buy Signal"
plot xSell = if bDownCurve and bSellFlag and bSellSqueeze and showBuySellSignals then 1 else na; # "X Sell Signal"

xBuy.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_UP);
xSell.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_DOWN);
xBuy.setDefaultColor(Color.CYAN);
xSell.setDefaultColor(Color.MAGENTA);


#End OF Code
 
check the below

CSS:
#// =-= THE ONE RENKO TO RULE THEM ALL =
#// Designed to be used on Renko 1s, Traditional 4. I primary trade the US 100 PEPPERSTONE (which is NQ futures)
#// Version 1 created by TraderOracle 11/18/2023
#// Version 1.1 - Fixed flag and squeeze overlapping, plus changed colors to be more intuitive
#study(title="The One Renko To Rule Them All", overlay=true, shorttitle="The One Renko 1.1")
# Converted by Sam4Cok@Samer800    - 12/2023

input showReversalSignals = no;        # "Show Flags"
input showSqueezeSignals = no;         # "Show Dots"
input showBuySellSignals = yes;        # "Show Big X for Buy/Sell"
input UseDeadSimpleReversal = no;      # "Use Dead Simple Reversal"

def na = Double.NaN;

def bUpCurve = close > close[1] and close[1] > close[2] and close[2] > close[3] and close[3] < close[4] and close[4] < close[5] and close[5] < close[6];# ? 1 : 0;
def bDownCurve = close < close[1] and close[1] < close[2] and close[2] < close[3] and close[3] > close[4] and close[4] > close[5] and close[5] > close[6];# ? 1 : 0

#//  ULTIMATE REVERSAL 1.22 =-=-=-=-=-=-=-=-=-
#// These are volume patterns I noticed after backtesting reversals for many months

DefineGlobalColor("cColor", CreateColor(194, 196, 197));
DefineGlobalColor("b1Color", CreateColor(199, 197, 197));
DefineGlobalColor("b0Color", CreateColor(255, 53, 53));

def basis = Average(close, 30);
def dev = 2 * StDev(close, 30);
def upper = basis + dev;
def lower = basis - dev;
def is0Green = close > open;
def is1Green = close[1] > open[1];
def is2Green = close[2] > open[2];
def is3Green = close[3] > open[3];
def is4Green = close[4] > open[4];
def is0Red = !is0Green;
def is1Red = !is1Green;
def is2Red = !is2Green;
def is3Red = !is3Green;
def is4Red = !is4Green;
#// Pattern #1 - small red bar, larger red bar, small green bar
def up1 = (volume[1] > volume[2] and volume < volume[1] and is0Green and is1Red and is2Red);
def down1 = (volume[1] > volume[2] and volume < volume[1] and is0Red and is1Green and is2Green);
#// Pattern #2 - small red bar, larger red bar, even LARGER red bar, small green bar
def up2 = (volume[2] > volume[3] and volume[3] > volume[4] and volume[1] < volume[2] and volume < volume[2] and is0Green and is1Red and is2Red and is3Red and is4Red);
def down2 = (volume[2] > volume[3] and volume[3] > volume[4] and volume[1] < volume[2] and volume < volume[2] and is0Red and is1Green and is2Green and is3Green and is4Green);
#// Pattern #3 - 4 bars of the same color, then a different color bar that's larger than all 4 previous
def up3 = (is1Red and is2Red and is3Red and is4Red and is0Green and volume > volume[1] and volume > volume[2] and volume > volume[3] and volume > volume[4]);
def down3 = (is1Green and is2Green and is3Green and is4Green and is0Red and volume > volume[1] and volume > volume[2] and volume > volume[3] and volume > volume[4]);
#// snippet from Candlestick Reversal System by LonesomeTheDove
script FindPivots {
    input dat = close; # default data or study being evaluated
    input HL  = 0;    # default high or low pivot designation, -1 low, +1 high
    input lbL  = 5;    # default Pivot Lookback Left
    input lbR  = 1;    # default Pivot Lookback Right
    ##############
    def _nan;    # used for non-number returns
    def _BN;     # the current barnumber
    def _VStop;  # confirms that the lookforward period continues the pivot trend
    def _V;      # the Value at the actual pivot point
    def _pivotRange;
    ##############
    _BN  = BarNumber();
    _nan = Double.NaN;
    _pivotRange = lbL + lbL;
    _VStop = if !IsNaN(dat[_pivotRange]) and lbR > 0 and lbL > 0 then
                fold a = 1 to lbR + 1 with b=1 while b do
                    if HL > 0 then dat > GetValue(dat, -a) else dat < GetValue(dat, -a) else _nan;
    if (HL > 0) {
        _V = if _BN > lbL and dat == Highest(dat, lbL + 1) and _VStop
            then dat else _nan;
    } else {
        _V = if _BN > lbL and dat == Lowest(dat, lbL + 1) and _VStop
            then dat else _nan;
    }
    plot result = if !IsNaN(_V) and _VStop then _V else _nan;
}
def pivotlbar = 5;
def highleftempty = findpivots(high, 1, pivotlbar, 0);
def lowleftempty  = findpivots(low - 1, pivotlbar, 0);
def wick_multiplier = 10;
def body_percentage = 1;
def O = open;
def C = close;
def H = high;
def L = low;
def Wlongsignal = (C > O) and (O - L) >= ((C - O) * wick_multiplier) and (H - C) <= ((H - L) * body_percentage) or
(C < O) and (C - L) >= ((O - C) * wick_multiplier) and (H - C) <= ((H - L) * body_percentage) or
(C == O and C != H) and (H - L) >= ((H - C) * wick_multiplier) and (H - C) <= ((H - L) * body_percentage) or
(O == H and C == H) and (H - L) >= Average((H - L), 50);
def Wshortsignal = (C < O) and (H - O) >= ((O - C) * wick_multiplier) and (C - L) <= ((H - L) * body_percentage) or
(C > O) and (H - C) >= ((C - O) * wick_multiplier) and (C - L) <= ((H - L) * body_percentage) or
(C == O and C != L) and (H - L) >= ((C - L) * wick_multiplier) and (C - L) <= ((H - L) * body_percentage) or
(O == L and C == L) and (H - L) >= Average((H - L), 50);

#// Candlestick pattern is technically Pattern #4
def up4 = !isNaN(lowleftempty) and Wlongsignal;
def down4 = !isNaN(highleftempty) and Wshortsignal;
def MyRsi = rsi(Price = close, Length = 14);

def up990 = (up1 or up2 or up3 or up4);
def down990 = (down1 or down2 or down3 or down4);
def bColor1;
def bColor = if (close < (lower - 2) or (lower - 2) and MyRsi < 30) then -1 else
             if (close > (upper + 2) or open > (upper + 2) and MyRsi > 80) then -1 else 0;
def down99 = if down99[1] then no else
             if (close > (upper + 2) or open > (upper + 2) and MyRsi > 80) then yes else
             if (MyRsi < 60) then no else down990;
def up99 = if up99[1] then no else
           if (close < (lower - 2) or (lower - 2) and MyRsi < 30) then yes else
           if (MyRsi > 40) then no else up990;

def atr = atr(Length = 10);
def pos2 = high + (1.1 * atr);
def pos3 = low  - (1.1 * atr);
#// My implementation of DEAD SIMPLE REVERSAL from PaidToFade
def q1 = close[1] < open[1] and close > open;
def q2 = close > open[1];
def q3 = Lowest(low, 3) < Lowest (low, 50)[1] or Lowest(low, 3) < Lowest(low, 50)[2] or Lowest(low, 3) < Lowest(low, 50)[3];
def buyme = q1 and q2 and q3;
def q4 = close[1] > open[1] and close < open;
def q5 = close < open[1];
def q6 = Highest(high, 3) > Highest (high, 50)[1] or Highest(high, 3) > Highest(high, 50)[2] or Highest(high, 3) > Highest(high, 50)[3];
def sellme = q4 and q5 and q6;

if (buyme and UseDeadSimpleReversal) {
    bColor1 = 1;
    } else
if (sellme and UseDeadSimpleReversal) {
    bColor1 = 1;
    } else {
    bColor1 = bColor;
}
plot RevSell = if down99 and showReversalSignals then pos2 else na; #"Reversal Sell Signal
RevSell.AssignValueColor(if bColor1 > 0 then Color.CYAN else
                         if bColor1 < 0 then Color.MAGENTA else color.WHITE);
RevSell.SetPaintingStrategy(PaintingStrategy.SQUARES);

plot RevBuy = if up99 and showReversalSignals then pos3 else na; # "Reversal Buy Signal
RevBuy.AssignValueColor(if bColor1 > 0 then Color.CYAN else
                        if bColor1 < 0 then Color.MAGENTA else color.WHITE);
RevBuy.SetPaintingStrategy(PaintingStrategy.SQUARES);

#// This is an improper use of TTM Squeeze.
#// Keltner Channel
def esma = ExpAverage(close, 20);
def ma1 = esma;
def rangema1 = atr(Length = 10);
def upper1 = ma1 + rangema1 * 2;
def lower1 = ma1 - rangema1 * 2;
def KeltnerCross = (close Crosses Above upper1) or (close Crosses Above lower1);
def sig = Reference adx();# // ADX DI Length = 14, ADX Length. = 14
def sigabove11 = sig > 11;# // ADX Value = 11
#// WAE Dead Zone
Script calc_macd {
input source = close;
input fastLength = 20;
input slowLength = 40;
    def fastMA = ExpAverage(source, fastLength);
    def slowMA = ExpAverage(source, slowLength);
    def calc_macd = fastMA - slowMA;
    plot out = calc_macd;
}
def t1 = (calc_macd(close, 20, 40) - calc_macd(close[1], 20, 40))*150;
def t2 = (calc_macd(close[2], 20, 40) - calc_macd(close[3], 20, 40))*150;
def trendUp = if (t1 >= 0) then t1 else 0;
def trendDown = if (t1 < 0) then (-1*t1) else 0;
#// Squeeze Momentum
def source = close;
def basis5 = Average(close, 20);
def dev1 = 1.5 * stdev(close, 20);
def upperBB = basis5 + dev1;
def lowerBB = basis5 - dev1;
def ma = Average(close, 20);
def tr = TrueRange(high, close, low);
def rangeQ = if !isNaN(tr) then tr else (high - low);
def rangema = Average(rangeQ, 20);
def upperKC = ma + rangema * 1.5;
def lowerKC = ma - rangema * 1.5;
def sqzOn = (lowerBB > lowerKC) and (upperBB < upperKC);
def sqzOff = (lowerBB < lowerKC) and (upperBB > upperKC);
def noSqz = (!sqzOn) and (!sqzOff);
#// Had to change this from the original
def avg1 = (highest(high, 20) + lowest(low, 20)) / 2;
def avg2 = (avg1 + Average(close, 20)) / 2;
def val = Inertia(close - avg2, 20);

def cGreen;# = 0
def cRed;# = 0
def pos;# = false
def neg;# = false

if (val < val[1] and cGreen[1] > 1 and val > 5 and !neg[2] and sigabove11) {
    cGreen = 0;
    neg = yes;
    cRed   = cRed[1];
    pos    = no;
    } else
if (val > val[1] and cRed[1] > 1 and val < 5 and !pos[2] and sigabove11) {
    cRed = 0;
    pos  = yes;
    cGreen = cGreen[1];
    neg    = neg[1];
    } else
if (val > val[1] and val > 5 and !sqzOn) {
    cGreen = cGreen[1] + 1;
    cRed   = cRed[1];
    pos    = no;#pos[1];
    neg    = no;#neg[1];
    } else
if (val < val[1] and val < 5 and !sqzOn) {
    cRed = cRed[1] + 1;
    cGreen = cGreen[1];
    pos    = no;#pos[1];
    neg    = no;#neg[1];
    } else {
    cGreen = cGreen[1];
    cRed   = cRed[1];
    pos    = no;#pos[1];
    neg    = no;#neg[1];
}
def buySignal1 = pos;
def sellSignal1 = neg;
#// Basic diamond color: Yellow as default, and Red is RSI is overbought or sold
def bColor4 = if(myrsi < 34 or myrsi > 66, -1, 0);

plot sqBuy = if buySignal1 and showSqueezeSignals then pos else na;#, title="Squeeze Buy Signal"
plot sqSell = if sellSignal1 and showSqueezeSignals then neg else na;#, title="Squeeze Sell Signal"

sqBuy.SetPaintingStrategy(PaintingStrategy.BOOLEAN_WEDGE_DOWN);
sqBuy.AssignValueColor(if bColor4 < 0 then Color.RED else CreateColor(189, 189, 189));
sqSell.SetPaintingStrategy(PaintingStrategy.BOOLEAN_WEDGE_UP);
sqSell.AssignValueColor(if bColor4 < 0 then Color.RED else CreateColor(189, 189, 189));

def bBuyFlag = buySignal1 or buySignal1[1] or buySignal1[2] or buySignal1[3] or buySignal1[4] or buySignal1[5] or buySignal1[6];
def bBuySqueeze = up99 or up99[1] or up99[2] or up99[3] or up99[4] or up99[5] or up99[6];
def bSellFlag = sellSignal1 or sellSignal1[1] or sellSignal1[2] or sellSignal1[3] or sellSignal1[4] or sellSignal1[5] or sellSignal1[6];
def bSellSqueeze = down99 or down99[1] or down99[2] or down99[3] or down99[4] or down99[5] or down99[6];

plot xBuy = if bUpCurve and bBuyFlag and bBuySqueeze and showBuySellSignals then 1 else na; # "X Buy Signal"
plot xSell = if bDownCurve and bSellFlag and bSellSqueeze and showBuySellSignals then 1 else na; # "X Sell Signal"

xBuy.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_UP);
xSell.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_DOWN);
xBuy.setDefaultColor(Color.CYAN);
xSell.setDefaultColor(Color.MAGENTA);


#End OF Code
@samer800 great job like always! thank you some much!
 
check the below

CSS:
#// =-= THE ONE RENKO TO RULE THEM ALL =
#// Designed to be used on Renko 1s, Traditional 4. I primary trade the US 100 PEPPERSTONE (which is NQ futures)
#// Version 1 created by TraderOracle 11/18/2023
#// Version 1.1 - Fixed flag and squeeze overlapping, plus changed colors to be more intuitive
#study(title="The One Renko To Rule Them All", overlay=true, shorttitle="The One Renko 1.1")
# Converted by Sam4Cok@Samer800    - 12/2023

input showReversalSignals = no;        # "Show Flags"
input showSqueezeSignals = no;         # "Show Dots"
input showBuySellSignals = yes;        # "Show Big X for Buy/Sell"
input UseDeadSimpleReversal = no;      # "Use Dead Simple Reversal"

def na = Double.NaN;

def bUpCurve = close > close[1] and close[1] > close[2] and close[2] > close[3] and close[3] < close[4] and close[4] < close[5] and close[5] < close[6];# ? 1 : 0;
def bDownCurve = close < close[1] and close[1] < close[2] and close[2] < close[3] and close[3] > close[4] and close[4] > close[5] and close[5] > close[6];# ? 1 : 0

#//  ULTIMATE REVERSAL 1.22 =-=-=-=-=-=-=-=-=-
#// These are volume patterns I noticed after backtesting reversals for many months

DefineGlobalColor("cColor", CreateColor(194, 196, 197));
DefineGlobalColor("b1Color", CreateColor(199, 197, 197));
DefineGlobalColor("b0Color", CreateColor(255, 53, 53));

def basis = Average(close, 30);
def dev = 2 * StDev(close, 30);
def upper = basis + dev;
def lower = basis - dev;
def is0Green = close > open;
def is1Green = close[1] > open[1];
def is2Green = close[2] > open[2];
def is3Green = close[3] > open[3];
def is4Green = close[4] > open[4];
def is0Red = !is0Green;
def is1Red = !is1Green;
def is2Red = !is2Green;
def is3Red = !is3Green;
def is4Red = !is4Green;
#// Pattern #1 - small red bar, larger red bar, small green bar
def up1 = (volume[1] > volume[2] and volume < volume[1] and is0Green and is1Red and is2Red);
def down1 = (volume[1] > volume[2] and volume < volume[1] and is0Red and is1Green and is2Green);
#// Pattern #2 - small red bar, larger red bar, even LARGER red bar, small green bar
def up2 = (volume[2] > volume[3] and volume[3] > volume[4] and volume[1] < volume[2] and volume < volume[2] and is0Green and is1Red and is2Red and is3Red and is4Red);
def down2 = (volume[2] > volume[3] and volume[3] > volume[4] and volume[1] < volume[2] and volume < volume[2] and is0Red and is1Green and is2Green and is3Green and is4Green);
#// Pattern #3 - 4 bars of the same color, then a different color bar that's larger than all 4 previous
def up3 = (is1Red and is2Red and is3Red and is4Red and is0Green and volume > volume[1] and volume > volume[2] and volume > volume[3] and volume > volume[4]);
def down3 = (is1Green and is2Green and is3Green and is4Green and is0Red and volume > volume[1] and volume > volume[2] and volume > volume[3] and volume > volume[4]);
#// snippet from Candlestick Reversal System by LonesomeTheDove
script FindPivots {
    input dat = close; # default data or study being evaluated
    input HL  = 0;    # default high or low pivot designation, -1 low, +1 high
    input lbL  = 5;    # default Pivot Lookback Left
    input lbR  = 1;    # default Pivot Lookback Right
    ##############
    def _nan;    # used for non-number returns
    def _BN;     # the current barnumber
    def _VStop;  # confirms that the lookforward period continues the pivot trend
    def _V;      # the Value at the actual pivot point
    def _pivotRange;
    ##############
    _BN  = BarNumber();
    _nan = Double.NaN;
    _pivotRange = lbL + lbL;
    _VStop = if !IsNaN(dat[_pivotRange]) and lbR > 0 and lbL > 0 then
                fold a = 1 to lbR + 1 with b=1 while b do
                    if HL > 0 then dat > GetValue(dat, -a) else dat < GetValue(dat, -a) else _nan;
    if (HL > 0) {
        _V = if _BN > lbL and dat == Highest(dat, lbL + 1) and _VStop
            then dat else _nan;
    } else {
        _V = if _BN > lbL and dat == Lowest(dat, lbL + 1) and _VStop
            then dat else _nan;
    }
    plot result = if !IsNaN(_V) and _VStop then _V else _nan;
}
def pivotlbar = 5;
def highleftempty = findpivots(high, 1, pivotlbar, 0);
def lowleftempty  = findpivots(low - 1, pivotlbar, 0);
def wick_multiplier = 10;
def body_percentage = 1;
def O = open;
def C = close;
def H = high;
def L = low;
def Wlongsignal = (C > O) and (O - L) >= ((C - O) * wick_multiplier) and (H - C) <= ((H - L) * body_percentage) or
(C < O) and (C - L) >= ((O - C) * wick_multiplier) and (H - C) <= ((H - L) * body_percentage) or
(C == O and C != H) and (H - L) >= ((H - C) * wick_multiplier) and (H - C) <= ((H - L) * body_percentage) or
(O == H and C == H) and (H - L) >= Average((H - L), 50);
def Wshortsignal = (C < O) and (H - O) >= ((O - C) * wick_multiplier) and (C - L) <= ((H - L) * body_percentage) or
(C > O) and (H - C) >= ((C - O) * wick_multiplier) and (C - L) <= ((H - L) * body_percentage) or
(C == O and C != L) and (H - L) >= ((C - L) * wick_multiplier) and (C - L) <= ((H - L) * body_percentage) or
(O == L and C == L) and (H - L) >= Average((H - L), 50);

#// Candlestick pattern is technically Pattern #4
def up4 = !isNaN(lowleftempty) and Wlongsignal;
def down4 = !isNaN(highleftempty) and Wshortsignal;
def MyRsi = rsi(Price = close, Length = 14);

def up990 = (up1 or up2 or up3 or up4);
def down990 = (down1 or down2 or down3 or down4);
def bColor1;
def bColor = if (close < (lower - 2) or (lower - 2) and MyRsi < 30) then -1 else
             if (close > (upper + 2) or open > (upper + 2) and MyRsi > 80) then -1 else 0;
def down99 = if down99[1] then no else
             if (close > (upper + 2) or open > (upper + 2) and MyRsi > 80) then yes else
             if (MyRsi < 60) then no else down990;
def up99 = if up99[1] then no else
           if (close < (lower - 2) or (lower - 2) and MyRsi < 30) then yes else
           if (MyRsi > 40) then no else up990;

def atr = atr(Length = 10);
def pos2 = high + (1.1 * atr);
def pos3 = low  - (1.1 * atr);
#// My implementation of DEAD SIMPLE REVERSAL from PaidToFade
def q1 = close[1] < open[1] and close > open;
def q2 = close > open[1];
def q3 = Lowest(low, 3) < Lowest (low, 50)[1] or Lowest(low, 3) < Lowest(low, 50)[2] or Lowest(low, 3) < Lowest(low, 50)[3];
def buyme = q1 and q2 and q3;
def q4 = close[1] > open[1] and close < open;
def q5 = close < open[1];
def q6 = Highest(high, 3) > Highest (high, 50)[1] or Highest(high, 3) > Highest(high, 50)[2] or Highest(high, 3) > Highest(high, 50)[3];
def sellme = q4 and q5 and q6;

if (buyme and UseDeadSimpleReversal) {
    bColor1 = 1;
    } else
if (sellme and UseDeadSimpleReversal) {
    bColor1 = 1;
    } else {
    bColor1 = bColor;
}
plot RevSell = if down99 and showReversalSignals then pos2 else na; #"Reversal Sell Signal
RevSell.AssignValueColor(if bColor1 > 0 then Color.CYAN else
                         if bColor1 < 0 then Color.MAGENTA else color.WHITE);
RevSell.SetPaintingStrategy(PaintingStrategy.SQUARES);

plot RevBuy = if up99 and showReversalSignals then pos3 else na; # "Reversal Buy Signal
RevBuy.AssignValueColor(if bColor1 > 0 then Color.CYAN else
                        if bColor1 < 0 then Color.MAGENTA else color.WHITE);
RevBuy.SetPaintingStrategy(PaintingStrategy.SQUARES);

#// This is an improper use of TTM Squeeze.
#// Keltner Channel
def esma = ExpAverage(close, 20);
def ma1 = esma;
def rangema1 = atr(Length = 10);
def upper1 = ma1 + rangema1 * 2;
def lower1 = ma1 - rangema1 * 2;
def KeltnerCross = (close Crosses Above upper1) or (close Crosses Above lower1);
def sig = Reference adx();# // ADX DI Length = 14, ADX Length. = 14
def sigabove11 = sig > 11;# // ADX Value = 11
#// WAE Dead Zone
Script calc_macd {
input source = close;
input fastLength = 20;
input slowLength = 40;
    def fastMA = ExpAverage(source, fastLength);
    def slowMA = ExpAverage(source, slowLength);
    def calc_macd = fastMA - slowMA;
    plot out = calc_macd;
}
def t1 = (calc_macd(close, 20, 40) - calc_macd(close[1], 20, 40))*150;
def t2 = (calc_macd(close[2], 20, 40) - calc_macd(close[3], 20, 40))*150;
def trendUp = if (t1 >= 0) then t1 else 0;
def trendDown = if (t1 < 0) then (-1*t1) else 0;
#// Squeeze Momentum
def source = close;
def basis5 = Average(close, 20);
def dev1 = 1.5 * stdev(close, 20);
def upperBB = basis5 + dev1;
def lowerBB = basis5 - dev1;
def ma = Average(close, 20);
def tr = TrueRange(high, close, low);
def rangeQ = if !isNaN(tr) then tr else (high - low);
def rangema = Average(rangeQ, 20);
def upperKC = ma + rangema * 1.5;
def lowerKC = ma - rangema * 1.5;
def sqzOn = (lowerBB > lowerKC) and (upperBB < upperKC);
def sqzOff = (lowerBB < lowerKC) and (upperBB > upperKC);
def noSqz = (!sqzOn) and (!sqzOff);
#// Had to change this from the original
def avg1 = (highest(high, 20) + lowest(low, 20)) / 2;
def avg2 = (avg1 + Average(close, 20)) / 2;
def val = Inertia(close - avg2, 20);

def cGreen;# = 0
def cRed;# = 0
def pos;# = false
def neg;# = false

if (val < val[1] and cGreen[1] > 1 and val > 5 and !neg[2] and sigabove11) {
    cGreen = 0;
    neg = yes;
    cRed   = cRed[1];
    pos    = no;
    } else
if (val > val[1] and cRed[1] > 1 and val < 5 and !pos[2] and sigabove11) {
    cRed = 0;
    pos  = yes;
    cGreen = cGreen[1];
    neg    = neg[1];
    } else
if (val > val[1] and val > 5 and !sqzOn) {
    cGreen = cGreen[1] + 1;
    cRed   = cRed[1];
    pos    = no;#pos[1];
    neg    = no;#neg[1];
    } else
if (val < val[1] and val < 5 and !sqzOn) {
    cRed = cRed[1] + 1;
    cGreen = cGreen[1];
    pos    = no;#pos[1];
    neg    = no;#neg[1];
    } else {
    cGreen = cGreen[1];
    cRed   = cRed[1];
    pos    = no;#pos[1];
    neg    = no;#neg[1];
}
def buySignal1 = pos;
def sellSignal1 = neg;
#// Basic diamond color: Yellow as default, and Red is RSI is overbought or sold
def bColor4 = if(myrsi < 34 or myrsi > 66, -1, 0);

plot sqBuy = if buySignal1 and showSqueezeSignals then pos else na;#, title="Squeeze Buy Signal"
plot sqSell = if sellSignal1 and showSqueezeSignals then neg else na;#, title="Squeeze Sell Signal"

sqBuy.SetPaintingStrategy(PaintingStrategy.BOOLEAN_WEDGE_DOWN);
sqBuy.AssignValueColor(if bColor4 < 0 then Color.RED else CreateColor(189, 189, 189));
sqSell.SetPaintingStrategy(PaintingStrategy.BOOLEAN_WEDGE_UP);
sqSell.AssignValueColor(if bColor4 < 0 then Color.RED else CreateColor(189, 189, 189));

def bBuyFlag = buySignal1 or buySignal1[1] or buySignal1[2] or buySignal1[3] or buySignal1[4] or buySignal1[5] or buySignal1[6];
def bBuySqueeze = up99 or up99[1] or up99[2] or up99[3] or up99[4] or up99[5] or up99[6];
def bSellFlag = sellSignal1 or sellSignal1[1] or sellSignal1[2] or sellSignal1[3] or sellSignal1[4] or sellSignal1[5] or sellSignal1[6];
def bSellSqueeze = down99 or down99[1] or down99[2] or down99[3] or down99[4] or down99[5] or down99[6];

plot xBuy = if bUpCurve and bBuyFlag and bBuySqueeze and showBuySellSignals then 1 else na; # "X Buy Signal"
plot xSell = if bDownCurve and bSellFlag and bSellSqueeze and showBuySellSignals then 1 else na; # "X Sell Signal"

xBuy.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_UP);
xSell.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_DOWN);
xBuy.setDefaultColor(Color.CYAN);
xSell.setDefaultColor(Color.MAGENTA);


#End OF Code
1701631479387.png

I can't install it.... Can you tell me why the error occurred?
 
Last edited:
What RENKO settings should be used with this indicator?

The OP states:
#// Designed to be used on Renko 1s, Traditional 4. I primary trade the US 100 PEPPERSTONE (which is NQ futures)

Renko settings are always set specifically per instrument being traded.
As with all indicators on this forum, you need to fine-tune the settings to best fit your strategy.
 
Last edited:
This study is a great reversal indicator. Thank you FOTM_8888 for sharing it. And of course, thank you samer800 for converting it into thinkscript.
 
#// =-= THE ONE RENKO TO RULE THEM ALL =
#// Designed to be used on Renko 1s, Traditional 4. I primary trade the US 100 PEPPERSTONE (which is NQ futures)
#// Version 1 created by TraderOracle 11/18/2023
#// Version 1.1 - Fixed flag and squeeze overlapping, plus changed colors to be more intuitive
#study(title="The One Renko To Rule Them All", overlay=true, shorttitle="The One Renko 1.1")
# Converted by Sam4Cok@Samer800 - 12/2023

input showReversalSignals = no; # "Show Flags"
input showSqueezeSignals = no; # "Show Dots"
input showBuySellSignals = yes; # "Show Big X for Buy/Sell"
input UseDeadSimpleReversal = no; # "Use Dead Simple Reversal"

def na = Double.NaN;

def bUpCurve = close > close[1] and close[1] > close[2] and close[2] > close[3] and close[3] < close[4] and close[4] < close[5] and close[5] < close[6];# ? 1 : 0;
def bDownCurve = close < close[1] and close[1] < close[2] and close[2] < close[3] and close[3] > close[4] and close[4] > close[5] and close[5] > close[6];# ? 1 : 0

#// ULTIMATE REVERSAL 1.22 =-=-=-=-=-=-=-=-=-
#// These are volume patterns I noticed after backtesting reversals for many months

DefineGlobalColor("cColor", CreateColor(194, 196, 197));
DefineGlobalColor("b1Color", CreateColor(199, 197, 197));
DefineGlobalColor("b0Color", CreateColor(255, 53, 53));

def basis = Average(close, 30);
def dev = 2 * StDev(close, 30);
def upper = basis + dev;
def lower = basis - dev;
def is0Green = close > open;
def is1Green = close[1] > open[1];
def is2Green = close[2] > open[2];
def is3Green = close[3] > open[3];
def is4Green = close[4] > open[4];
def is0Red = !is0Green;
def is1Red = !is1Green;
def is2Red = !is2Green;
def is3Red = !is3Green;
def is4Red = !is4Green;
#// Pattern #1 - small red bar, larger red bar, small green bar
def up1 = (volume[1] > volume[2] and volume < volume[1] and is0Green and is1Red and is2Red);
def down1 = (volume[1] > volume[2] and volume < volume[1] and is0Red and is1Green and is2Green);
#// Pattern #2 - small red bar, larger red bar, even LARGER red bar, small green bar
def up2 = (volume[2] > volume[3] and volume[3] > volume[4] and volume[1] < volume[2] and volume < volume[2] and is0Green and is1Red and is2Red and is3Red and is4Red);
def down2 = (volume[2] > volume[3] and volume[3] > volume[4] and volume[1] < volume[2] and volume < volume[2] and is0Red and is1Green and is2Green and is3Green and is4Green);
#// Pattern #3 - 4 bars of the same color, then a different color bar that's larger than all 4 previous
def up3 = (is1Red and is2Red and is3Red and is4Red and is0Green and volume > volume[1] and volume > volume[2] and volume > volume[3] and volume > volume[4]);
def down3 = (is1Green and is2Green and is3Green and is4Green and is0Red and volume > volume[1] and volume > volume[2] and volume > volume[3] and volume > volume[4]);
#// snippet from Candlestick Reversal System by LonesomeTheDove
script FindPivots {
input dat = close; # default data or study being evaluated
input HL = 0; # default high or low pivot designation, -1 low, +1 high
input lbL = 5; # default Pivot Lookback Left
input lbR = 1; # default Pivot Lookback Right
##############
def _nan; # used for non-number returns
def _BN; # the current barnumber
def _VStop; # confirms that the lookforward period continues the pivot trend
def _V; # the Value at the actual pivot point
def _pivotRange;
##############
_BN = BarNumber();
_nan = Double.NaN;
_pivotRange = lbL + lbL;
_VStop = if !IsNaN(dat[_pivotRange]) and lbR > 0 and lbL > 0 then
fold a = 1 to lbR + 1 with b=1 while b do
if HL > 0 then dat > GetValue(dat, -a) else dat < GetValue(dat, -a) else _nan;
if (HL > 0) {
_V = if _BN > lbL and dat == Highest(dat, lbL + 1) and _VStop
then dat else _nan;
} else {
_V = if _BN > lbL and dat == Lowest(dat, lbL + 1) and _VStop
then dat else _nan;
}
plot result = if !IsNaN(_V) and _VStop then _V else _nan;
}
def pivotlbar = 5;
def highleftempty = findpivots(high, 1, pivotlbar, 0);
def lowleftempty = findpivots(low - 1, pivotlbar, 0);
def wick_multiplier = 10;
def body_percentage = 1;
def O = open;
def C = close;
def H = high;
def L = low;
def Wlongsignal = (C > O) and (O - L) >= ((C - O) * wick_multiplier) and (H - C) <= ((H - L) * body_percentage) or
(C < O) and (C - L) >= ((O - C) * wick_multiplier) and (H - C) <= ((H - L) * body_percentage) or
(C == O and C != H) and (H - L) >= ((H - C) * wick_multiplier) and (H - C) <= ((H - L) * body_percentage) or
(O == H and C == H) and (H - L) >= Average((H - L), 50);
def Wshortsignal = (C < O) and (H - O) >= ((O - C) * wick_multiplier) and (C - L) <= ((H - L) * body_percentage) or
(C > O) and (H - C) >= ((C - O) * wick_multiplier) and (C - L) <= ((H - L) * body_percentage) or
(C == O and C != L) and (H - L) >= ((C - L) * wick_multiplier) and (C - L) <= ((H - L) * body_percentage) or
(O == L and C == L) and (H - L) >= Average((H - L), 50);

#// Candlestick pattern is technically Pattern #4
def up4 = !isNaN(lowleftempty) and Wlongsignal;
def down4 = !isNaN(highleftempty) and Wshortsignal;
def MyRsi = rsi(Price = close, Length = 14);

def up990 = (up1 or up2 or up3 or up4);
def down990 = (down1 or down2 or down3 or down4);
def bColor1;
def bColor = if (close < (lower - 2) or (lower - 2) and MyRsi < 30) then -1 else
if (close > (upper + 2) or open > (upper + 2) and MyRsi > 80) then -1 else 0;
def down99 = if down99[1] then no else
if (close > (upper + 2) or open > (upper + 2) and MyRsi > 80) then yes else
if (MyRsi < 60) then no else down990;
def up99 = if up99[1] then no else
if (close < (lower - 2) or (lower - 2) and MyRsi < 30) then yes else
if (MyRsi > 40) then no else up990;

def atr = atr(Length = 10);
def pos2 = high + (1.1 * atr);
def pos3 = low - (1.1 * atr);
#// My implementation of DEAD SIMPLE REVERSAL from PaidToFade
def q1 = close[1] < open[1] and close > open;
def q2 = close > open[1];
def q3 = Lowest(low, 3) < Lowest (low, 50)[1] or Lowest(low, 3) < Lowest(low, 50)[2] or Lowest(low, 3) < Lowest(low, 50)[3];
def buyme = q1 and q2 and q3;
def q4 = close[1] > open[1] and close < open;
def q5 = close < open[1];
def q6 = Highest(high, 3) > Highest (high, 50)[1] or Highest(high, 3) > Highest(high, 50)[2] or Highest(high, 3) > Highest(high, 50)[3];
def sellme = q4 and q5 and q6;

if (buyme and UseDeadSimpleReversal) {
bColor1 = 1;
} else
if (sellme and UseDeadSimpleReversal) {
bColor1 = 1;
} else {
bColor1 = bColor;
}
plot RevSell = if down99 and showReversalSignals then pos2 else na; #"Reversal Sell Signal
RevSell.AssignValueColor(if bColor1 > 0 then Color.CYAN else
if bColor1 < 0 then Color.MAGENTA else color.WHITE);
RevSell.SetPaintingStrategy(PaintingStrategy.SQUARES);

plot RevBuy = if up99 and showReversalSignals then pos3 else na; # "Reversal Buy Signal
RevBuy.AssignValueColor(if bColor1 > 0 then Color.CYAN else
if bColor1 < 0 then Color.MAGENTA else color.WHITE);
RevBuy.SetPaintingStrategy(PaintingStrategy.SQUARES);

#// This is an improper use of TTM Squeeze.
#// Keltner Channel
def esma = ExpAverage(close, 20);
def ma1 = esma;
def rangema1 = atr(Length = 10);
def upper1 = ma1 + rangema1 * 2;
def lower1 = ma1 - rangema1 * 2;
def KeltnerCross = (close Crosses Above upper1) or (close Crosses Above lower1);
def sig = Reference adx();# // ADX DI Length = 14, ADX Length. = 14
def sigabove11 = sig > 11;# // ADX Value = 11
#// WAE Dead Zone
Script calc_macd {
input source = close;
input fastLength = 20;
input slowLength = 40;
def fastMA = ExpAverage(source, fastLength);
def slowMA = ExpAverage(source, slowLength);
def calc_macd = fastMA - slowMA;
plot out = calc_macd;
}
def t1 = (calc_macd(close, 20, 40) - calc_macd(close[1], 20, 40))*150;
def t2 = (calc_macd(close[2], 20, 40) - calc_macd(close[3], 20, 40))*150;
def trendUp = if (t1 >= 0) then t1 else 0;
def trendDown = if (t1 < 0) then (-1*t1) else 0;
#// Squeeze Momentum
def source = close;
def basis5 = Average(close, 20);
def dev1 = 1.5 * stdev(close, 20);
def upperBB = basis5 + dev1;
def lowerBB = basis5 - dev1;
def ma = Average(close, 20);
def tr = TrueRange(high, close, low);
def rangeQ = if !isNaN(tr) then tr else (high - low);
def rangema = Average(rangeQ, 20);
def upperKC = ma + rangema * 1.5;
def lowerKC = ma - rangema * 1.5;
def sqzOn = (lowerBB > lowerKC) and (upperBB < upperKC);
def sqzOff = (lowerBB < lowerKC) and (upperBB > upperKC);
def noSqz = (!sqzOn) and (!sqzOff);
#// Had to change this from the original
def avg1 = (highest(high, 20) + lowest(low, 20)) / 2;
def avg2 = (avg1 + Average(close, 20)) / 2;
def val = Inertia(close - avg2, 20);

def cGreen;# = 0
def cRed;# = 0
def pos;# = false
def neg;# = false

if (val < val[1] and cGreen[1] > 1 and val > 5 and !neg[2] and sigabove11) {
cGreen = 0;
neg = yes;
cRed = cRed[1];
pos = no;
} else
if (val > val[1] and cRed[1] > 1 and val < 5 and !pos[2] and sigabove11) {
cRed = 0;
pos = yes;
cGreen = cGreen[1];
neg = neg[1];
} else
if (val > val[1] and val > 5 and !sqzOn) {
cGreen = cGreen[1] + 1;
cRed = cRed[1];
pos = no;#pos[1];
neg = no;#neg[1];
} else
if (val < val[1] and val < 5 and !sqzOn) {
cRed = cRed[1] + 1;
cGreen = cGreen[1];
pos = no;#pos[1];
neg = no;#neg[1];
} else {
cGreen = cGreen[1];
cRed = cRed[1];
pos = no;#pos[1];
neg = no;#neg[1];
}
def buySignal1 = pos;
def sellSignal1 = neg;
#// Basic diamond color: Yellow as default, and Red is RSI is overbought or sold
def bColor4 = if(myrsi < 34 or myrsi > 66, -1, 0);

plot sqBuy = if buySignal1 and showSqueezeSignals then pos else na;#, title="Squeeze Buy Signal"
plot sqSell = if sellSignal1 and showSqueezeSignals then neg else na;#, title="Squeeze Sell Signal"

sqBuy.SetPaintingStrategy(PaintingStrategy.BOOLEAN_WEDGE_DOWN);
sqBuy.AssignValueColor(if bColor4 < 0 then Color.RED else CreateColor(189, 189, 189));
sqSell.SetPaintingStrategy(PaintingStrategy.BOOLEAN_WEDGE_UP);
sqSell.AssignValueColor(if bColor4 < 0 then Color.RED else CreateColor(189, 189, 189));

def bBuyFlag = buySignal1 or buySignal1[1] or buySignal1[2] or buySignal1[3] or buySignal1[4] or buySignal1[5] or buySignal1[6];
def bBuySqueeze = up99 or up99[1] or up99[2] or up99[3] or up99[4] or up99[5] or up99[6];
def bSellFlag = sellSignal1 or sellSignal1[1] or sellSignal1[2] or sellSignal1[3] or sellSignal1[4] or sellSignal1[5] or sellSignal1[6];
def bSellSqueeze = down99 or down99[1] or down99[2] or down99[3] or down99[4] or down99[5] or down99[6];

plot xBuy = if bUpCurve and bBuyFlag and bBuySqueeze and showBuySellSignals then 1 else na; # "X Buy Signal"
plot xSell = if bDownCurve and bSellFlag and bSellSqueeze and showBuySellSignals then 1 else na; # "X Sell Signal"

xBuy.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_UP);
xSell.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_DOWN);
xBuy.setDefaultColor(Color.CYAN);
xSell.setDefaultColor(Color.MAGENTA);


#End OF Code
 

Join useThinkScript to post your question to a community of 21,000+ developers and traders.

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
334 Online
Create Post

Similar threads

Similar threads

The Market Trading Game Changer

Join 2,500+ subscribers inside the useThinkScript VIP Membership Club
  • Exclusive indicators
  • Proven strategies & setups
  • Private Discord community
  • ‘Buy The Dip’ signal alerts
  • Exclusive members-only content
  • Add-ons and resources
  • 1 full year of unlimited support

Frequently Asked Questions

What is useThinkScript?

useThinkScript is the #1 community of stock market investors using indicators and other tools to power their trading strategies. Traders of all skill levels use our forums to learn about scripting and indicators, help each other, and discover new ways to gain an edge in the markets.

How do I get started?

We get it. Our forum can be intimidating, if not overwhelming. With thousands of topics, tens of thousands of posts, our community has created an incredibly deep knowledge base for stock traders. No one can ever exhaust every resource provided on our site.

If you are new, or just looking for guidance, here are some helpful links to get you started.

What are the benefits of VIP Membership?
VIP members get exclusive access to these proven and tested premium indicators: Buy the Dip, Advanced Market Moves 2.0, Take Profit, and Volatility Trading Range. In addition, VIP members get access to over 50 VIP-only custom indicators, add-ons, and strategies, private VIP-only forums, private Discord channel to discuss trades and strategies in real-time, customer support, trade alerts, and much more. Learn all about VIP membership here.
How can I access the premium indicators?
To access the premium indicators, which are plug and play ready, sign up for VIP membership here.
Back
Top