Repaints Trade Suite For ThinkOrSwim

Repaints

datcv09

New member
The bands are MESA Moving Averages by John Ehlers
The bubbles are calculated with the Leledc Exhaustion Indicator
The trend values printed on the chart are WaveTrend Signals

0OedFbZ.png



I just want to share a cool Tradingview Indicator and wondering if it can be converted into thinkscript
https://www.tradingview.com/script/16Da1RcQ-LordPepe-Stochastic-Signals/

Hello @samer800,
is it possible for you to take a look at this script and convert it into thinkscript. Its a really good support/resistance indicator
 
Last edited by a moderator:

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

I just want to share a cool Tradingview Indicator and wondering if it can be converted into thinkscript

https://www.tradingview.com/script/16Da1RcQ-LordPepe-Stochastic-Signals/
This indicator generates some solid support/resistance along with buy and sell signal
Here's the code of this indicator
//@version=5
indicator(title="Exhaustion Suite", shorttitle="X Suite", overlay=true)
exShowTip = 'This will enable and disable the exhaustion support and resistance lines.'
exSourceTip = 'Choose a'
exSwingTip = 'This will check if we have a lower low or higher high than x bars back. Higher x will give less signals. 40 is arbitrary number. Find settings that work best for your trading style.'
exBarCount = 'This will control how many exhausted bars to count before looking for the highest high/lowest low to give signal. 10 is arbitrary number. Find settings that work best for your trading style.'
exBarsBack = 'This controls the sensitivity of an exhausted bar. Exaustion is a close > close x bars ago. This setting controls the x.'
superPositionTip = 'This will produce signals that are appear on the higher timeframe exhaustion and the current timeframe.'
exhaustionShow = input.bool(true, title='Show S/R Lines?', group='Exhaustion', tooltip=exShowTip, inline = '1')
exhaustionSource = input.source(close, title="Source", group='Exhaustion', inline = '2')
exhaustionSwing = input.int(40, title="Swing Length", group='Exhaustion', tooltip=exSwingTip, inline = '3')
exhaustionBarCount = input.int(10, title="Bar Count", group='Exhaustion', tooltip=exBarCount, inline = '4')
exhaustionBarsBack = input.int(4, title="Bars Back", group='Exhaustion', tooltip=exBarsBack, inline = '5')
exhaustionLineSize = input.int(1, title="S/R Size", group='Exhaustion', inline = '6')
supportColor = input.color(#20d400, title='TF1 Support Color', group='Exhaustion', inline = '7')
resistanceColor = input.color(#ed2f00, title='TF1 Resistance Color', group='Exhaustion', inline = '7')
exhaustionHigherTFShow = input.bool(false, title='Higher Timeframe Show?', group = 'Exhaustion', inline = '8')
exhaustionHigherTrendTF = input.timeframe('240', title='Higher Timeframe Signals', group='Exhaustion', inline = '8')
hSupportColor = input.color(#005be3, title='TF2 Support Color', group='Exhaustion', inline = '9')
hResistanceColor = input.color(#5b00e3, title='TF2 Resistance Color', group='Exhaustion', inline = '9')
superPositionSignals = input.bool(false, title = 'Super Position Signals? (under testing)', group = 'Exhaustion', tooltip=superPositionTip)

exhaustion(BARS, SWING_LEN, B_BACK, SRC) =>
var bullCount = 0
var bearCount = 0
ret = 0

k = ta.stoch(close, high, low, 8)
adr = ta.sma(high, 14) - ta.sma(low, 14)
adr_mean = ta.sma(adr, 20)

bullCount := SRC > SRC[B_BACK] ? bullCount + 1 : bullCount
bearCount := SRC < SRC[B_BACK] ? bearCount + 1 : bearCount

lowest_ = ta.lowest(low, SWING_LEN)
highest_ = ta.highest(high, SWING_LEN)

if(bullCount > BARS and close < open and high >= highest_)
bullCount := 0
ret = -1
else if(bearCount > BARS and close > open and low <= lowest_)
bearCount := 0
ret = 1



trend = exhaustion(exhaustionBarCount, exhaustionSwing, exhaustionBarsBack, exhaustionSource)
top = trend == -1 ? high : na
bottom = trend == 1 ? low : na
resistance = float(na)
support = float(na)
resistance := close < open and trend ? high : resistance[1]
support := close > open and trend ? low : support[1]
rescol = resistanceColor
resColor = ta.change(resistance) == 0 ? rescol: na
supcol = supportColor
supColor = ta.change(support) == 0 ? supcol : na
plotchar(exhaustionShow ? bottom:na, title="Buy", color=supcol, location=location.belowbar, char = '🡹', size=size.tiny)
plotchar(exhaustionShow ? top:na, title="Sell", color=rescol, location=location.abovebar, char = '🢃', size=size.tiny)
//Plot level
plot(exhaustionShow ? resistance :na, title="Reistance Level", style=plot.style_line, color=resColor, linewidth=exhaustionLineSize)
plot(exhaustionShow ? support :na, title="Support Level", style=plot.style_line, color=supColor, linewidth=exhaustionLineSize)

higherTFSource = request.security(syminfo.tickerid, exhaustionHigherTrendTF, exhaustionSource)
htfHigh = request.security(syminfo.tickerid, exhaustionHigherTrendTF, high)
htfLow = request.security(syminfo.tickerid, exhaustionHigherTrendTF, low)
htfOpen = request.security(syminfo.tickerid, exhaustionHigherTrendTF, open)

htfExhaustion(BARS, SWING_LEN, B_BACK, SRC) =>
var bullCount = 0
var bearCount = 0
ret = 0

k = ta.stoch(higherTFSource, htfHigh, htfLow, 8)
adr = ta.sma(htfHigh, 14) - ta.sma(htfLow, 14)
adr_mean = ta.sma(adr, 20)

bullCount := SRC > SRC[B_BACK] ? bullCount + 1 : bullCount
bearCount := SRC < SRC[B_BACK] ? bearCount + 1 : bearCount

lowest_ = ta.lowest(htfLow, SWING_LEN)
highest_ = ta.highest(htfHigh, SWING_LEN)

if(bullCount > BARS and higherTFSource < htfOpen and htfHigh >= highest_)
bullCount := 0
ret = -1
else if(bearCount > BARS and higherTFSource > htfOpen and htfLow <= lowest_)
bearCount := 0
ret = 1

higherTrend = htfExhaustion(exhaustionBarCount, exhaustionSwing, exhaustionBarsBack, higherTFSource)

hTop = higherTrend == -1 ? htfHigh : na
hBottom = higherTrend == 1 ? htfLow : na
hResistance = float(na)
hSupport = float(na)
hResistance := higherTFSource < htfOpen and higherTrend ? htfHigh : hResistance[1]
hSupport := higherTFSource > htfOpen and higherTrend ? htfLow : hSupport[1]

hrescol = hResistanceColor
hresColor = ta.change(hResistance) == 0 ? hrescol: na
hsupcol = hSupportColor
hsupColor = ta.change(hSupport) == 0 ? hsupcol : na
plotshape(exhaustionHigherTFShow ? hBottom:na, title="Buy", color=hsupcol, location=location.belowbar, style = shape.triangleup, size=size.normal)
plotshape(exhaustionHigherTFShow ? hTop:na, title="Sell", color=hrescol, location=location.abovebar, style = shape.triangledown, size=size.normal)
//Plot level
plot(exhaustionHigherTFShow ? hResistance :na, title="Reistance Level", style=plot.style_linebr, color=hresColor, linewidth=exhaustionLineSize)
plot(exhaustionHigherTFShow ? hSupport :na, title="Support Level", style=plot.style_linebr, color=hsupColor, linewidth=exhaustionLineSize)
superPositionBuy = trend == 1 and higherTrend == 1
superPositionSell = trend == -1 and higherTrend == -1
plotshape(superPositionSignals ? superPositionBuy : na, location=location.belowbar, style = shape.triangleup, size=size.normal, color=hsupcol)
plotshape(superPositionSignals ? superPositionSell : na, location=location.abovebar, style = shape.triangledown, size=size.normal, color=hrescol)



//=============================================================================================================
//MESA Moving Average`
mesaToolTip = 'This will show the MESA MA on another timeframe of your choosing. Great for knowing larger trends while diving into smaller ones.'
show = input(false, inline = '3', title="Show MESA for selected higher timeframes", tooltip = mesaToolTip, group = 'MESA')
_tf = input.timeframe(defval='0', inline = '3', title="Timeframe", group = 'MESA')
mesa = input.bool(true, title='MESA MA', inline='0', group='MESA')
tf1 = _tf == '0' ? timeframe.period : _tf
srcb = close
src1 = request.security(syminfo.tickerid, tf1, close, barmerge.gaps_on)
fast = 0.25
slow = 0.05
getMESA(src_in, fast, slow, show) =>
MAMA = 0.0
FAMA = 0.0
Price = src_in
FastLimit = fast
SlowLimit = slow
PI = 3.14159
Smooth = 0.0
Detrender = 0.0
I1 = 0.0
Q1 = 0.0
jI = 0.0
jQ = 0.0
I2 = 0.0
Q2 = 0.0
Re = 0.0
Im = 0.0
Period = 0.0
SmoothPeriod = 0.0
Phase = 0.0
DeltaPhase = 0.0
alpha = 0.0
if bar_index > 5 and show and not na(Price)
Smooth := (4 * Price + 3 * Price[1] + 2 * Price[2] + Price[3]) / 10
Detrender := (0.0962 * Smooth + 0.5769 * Smooth[2] - 0.5769 * Smooth[4] - 0.0962 * Smooth[6]) *
(0.075 * Period[1] + 0.54)
//Get the Inphase & Quadtrature Components
Q1 := (0.0962 * Detrender + 0.5769 * Detrender[2] - 0.5769 * Detrender[4] -
0.0962 * Detrender[6]) * (0.075 * Period[1] + 0.54)
I1 := Detrender[3]
//Advance phase angle by 90 deg
jI := (0.0962 * I1 + 0.5769 * I1[2] - 0.5769 * I1[4] - 0.0962 * I1[6]) *
(0.075 * Period[1] + 0.54)
jQ := (0.0962 * Q1 + 0.5769 * Q1[2] - 0.5769 * Q1[4] - 0.0962 * Q1[6]) *
(0.075 * Period[1] + 0.54)
//Phasor addition for 3-bar averaging
I2 := I1 - jQ
Q2 := Q1 + jI
//Smooth the I and Q components before applying the discriminator
I2 := 0.2 * I2 + 0.8 * I2[1]
Q2 := 0.2 * Q2 + 0.8 * Q2[1]
//Homodyne Discriminator
Re := I2 * I2[1] + Q2 * Q2[1]
Im := I2 * Q2[1] - Q2 * I2[1]
Re := 0.2 * Re + 0.8 * Re[1]
Im := 0.2 * Im + 0.8 * Im[1]
if Im != 0 and Re != 0
Period := 2 * PI / math.atan(Im / Re)
Period := Period>1.5*Period[1] ? 1.5*Period[1] : Period
Period := Period>50 ? 50 : Period
Period := Period<0.67*Period[1] ? 0.67*Period[1] : Period
Period := Period<6 ? 6 : Period
Period := 0.2*Period + 0.8*Period[1]
SmoothPeriod := 0.33 * Period + 0.67 * SmoothPeriod[1]
if I1 != 0
Phase := 180 / PI * math.atan(Q1 / I1)
DeltaPhase := Phase[1] - Phase
if DeltaPhase < 1
DeltaPhase := 1
alpha := FastLimit / DeltaPhase
alpha := alpha<SlowLimit ? SlowLimit : alpha
alpha := alpha>FastLimit ? FastLimit : alpha
MAMA := alpha * Price + (1 - alpha) * MAMA[1]
FAMA := 0.5 * alpha * MAMA + (1 - 0.5 * alpha) * FAMA[1]
if bar_index > 5 and show and na(Price)
MAMA := MAMA[1]
FAMA := FAMA[1]
if not show
MAMA := na
FAMA := na
[MAMA, FAMA]

[M_cur, F_cur] = getMESA(srcb, fast, slow, true)
[M_1, F_1] = getMESA(src1, fast, slow, show)
//BASELINE PLOT - includes the MAMA, FAMA, and fill
mamaColor = input.color(#138484, title='MAMA Color', group='MESA')
famaColor = input.color(#ff0000, title='FAMA Color', group='MESA')
cloudBars = input.bool(true, title='MESA MA Colored Bars?')
cloudBull = input.color(#42e3f5, title='Cloud Colored Bars')
cloudBear = input.color(#d6d6d6, title='Cloud Colored Bars')
cloudColors = M_cur > F_cur ? cloudBull : cloudBear
// Update charts
barcolor(cloudBars ? cloudColors : na)
p_m_cur = plot(mesa ? M_cur:na, "MAMA", mamaColor, 1)
p_f_cur = plot(mesa ? F_cur:na, "FAMA", famaColor, 1)
fill(p_m_cur, p_f_cur, M_cur > F_cur ? color.new(cloudBull, 90) : color.new(cloudBear, 90))
//SECONDARY PLOT - includes timeframe 1
p_m_1 = plot(mesa ? M_1:na, "MAMA Higher TF", mamaColor, 1)
p_f_1 = plot(mesa ? F_1:na, "FAMA Higher TF", famaColor, 1)
fill(p_m_1, p_f_1, M_cur > F_cur ? color.new(cloudBull, 90) : color.new(cloudBear, 90))




// Wavetrend Zone
//=============================================================================================================
// WaveTrend by VuManChu
wtMASource = input.source(hlc3, inline = '4', title = 'WT MA Source', group = 'Wavetrend')
wtChannelLen = input(9, inline = '5', title = 'WT Channel Length', group = 'Wavetrend')
wtAverageLen = input(12, inline = '5', title = 'WT Average Length', group = 'Wavetrend')
wtMALen = input(3, inline = '5', title = 'WT MA Length', group = 'Wavetrend')
obosSignalsTip = '1, 2, and 3 are overbought and oversold signals. The bullish numbers appear on bottom for bullish and on top for bearish. You can set these levels by changing the Wavetrend OB and OS levels.'
// WaveTrend Overbought & Oversold lines
obLevel1 = input(40, inline = '6', title = 'WT OB 1', group = 'Wavetrend')
obLevel2 = input(60, inline = '6', title = 'WT OB 2', group = 'Wavetrend')
obLevel3 = input(75, inline = '6', title = 'WT OB 3', group = 'Wavetrend')
osLevel1 = input(-40, inline = '7', title = 'WT OS 1', group = 'Wavetrend')
osLevel2 = input(-60, inline = '7', title = 'WT OS 2', group = 'Wavetrend')
osLevel3 = input(-75, inline = '7', title = 'WT OS 3', group = 'Wavetrend')
colorWTB1 = input.color(#fffb00, inline = '1', title = 'L1B', group = 'Wavetrend')
colorWTS1 = input.color(#ff9d00, inline = '1', title = 'L1S', group = 'Wavetrend')
colorWTB2 = input.color(#9dff00, inline = '1', title = 'L2B', group = 'Wavetrend')
colorWTS2 = input.color(#ff8400, inline = '1', title = 'L2S', group = 'Wavetrend')
colorWTB3 = input.color(#32a84a, inline = '1', title = 'L3B', group = 'Wavetrend')
colorWTS3 = input.color(#ff0000, inline = '1', title = 'L3S', group = 'Wavetrend', tooltip=obosSignalsTip)
level1Tip = 'Fastest WaveTrend signal. Best for low timeframe scalps but also very good at larger timeframes. Use with moving averages.'
level2Tip = "Intermediate WaveTrend signal. Best for confirming a potential reversal. Uptrend is different than downtrend as they could be used as reload zones if moving averages aren't broken."
level3Tip = 'Slowest WaveTrend signal. Best for most likely reversal senario. Should be used in conjunction with other indicators for confirmation. e.g. Exhaustion signal + Level 3 WaveTrend.'
lev1Sig = input.bool(false, title='Level 1 Signals', tooltip=level1Tip)
lev2Sig = input.bool(false, title='Level 2 Signals', tooltip=level2Tip)
lev3Sig = input.bool(true, title='Level 3 Signals', tooltip=level3Tip)

f_wavetrend(src, chlen, avg, malen, tf) =>
tfsrc = request.security(syminfo.tickerid, tf, src)
esa = ta.ema(tfsrc, chlen)
de = ta.ema(math.abs(tfsrc - esa), chlen)
ci = (tfsrc - esa) / (0.015 * de)
wt1 = request.security(syminfo.tickerid, tf, ta.ema(ci, avg))
wt2 = request.security(syminfo.tickerid, tf, ta.sma(wt1, malen))
wtVwap = wt1 - wt2
wtOversold = wt2 <= osLevel1
wtOverbought = wt2 >= obLevel1
wtCross = ta.cross(wt1, wt2)
wtCrossUp = wt2 - wt1 <= 0
wtCrossDown = wt2 - wt1 >= 0
wtCrosslast = ta.cross(wt1[2], wt2[2])
wtCrossUplast = wt2[2] - wt1[2] <= 0
wtCrossDownlast = wt2[2] - wt1[2] >= 0
[wt1, wt2, wtOversold, wtOverbought, wtCross, wtCrossUp, wtCrossDown, wtCrosslast, wtCrossUplast, wtCrossDownlast, wtVwap]

// Calculates WaveTrend
[wt1, wt2, wtOversold, wtOverbought, wtCross, wtCrossUp, wtCrossDown, wtCross_last, wtCrossUp_last, wtCrossDown_last, wtVwap] = f_wavetrend(wtMASource, wtChannelLen, wtAverageLen, wtMALen, timeframe.period)

lev1Buy = ta.crossover(wt1, wt2) and wt1 <= osLevel1 and wt1 > osLevel2
lev1Sell = ta.crossunder(wt1, wt2) and wt1 >= obLevel1 and wt1 < obLevel2
lev2Buy = ta.crossover(wt1, wt2) and wt1 <= osLevel2 and wt1 > osLevel3
lev2Sell = ta.crossunder(wt1, wt2) and wt1 >= obLevel2 and wt1 < obLevel3
lev3Buy = ta.crossover(wt1, wt2) and wt1 <= osLevel3
lev3Sell = ta.crossunder(wt1, wt2) and wt1 >= obLevel3

plotchar(lev1Sig ? lev1Buy:na, char = 'Ⅰ', location = location.belowbar, color = colorWTB1, size = size.tiny)
plotchar(lev1Sig ? lev1Sell:na, char = 'Ⅰ', location = location.abovebar, color = colorWTS1, size = size.tiny)
plotchar(lev2Sig ? lev2Buy:na, char = 'Ⅱ', location = location.belowbar, color = colorWTB2, size = size.tiny)
plotchar(lev2Sig ? lev2Sell:na, char = 'Ⅱ', location = location.abovebar, color = colorWTS2, size = size.tiny)
plotchar(lev3Sig ? lev3Buy:na, char = 'Ⅲ', location = location.belowbar, color = colorWTB3, size = size.tiny)
plotchar(lev3Sig ? lev3Sell:na, char = 'Ⅲ', location = location.abovebar, color = colorWTS3, size = size.tiny)

Hello @samer800,
is it possible for you to take a look at this script and convert it into thinkscript. Its a really good support/resistance indicator
check the below:

CSS:
#https://www.tradingview.com/v/16Da1RcQ/
#//@copeharder
#indicator(title="Trade Suite", shorttitle="tsuite", overlay=true)
#// MESA Moving Average by John Ehlers
# - converted by Sam4Cok@Samer800    - 06/2024
input ColoredBars = yes; #(true, title='MESA MA Colored Bars?', group=groupMesa)
input showHigherTimeframeMESA = no; #(false, title="Show MESA for selected higher timeframes", group=groupMesa)
input mesaHigherTimeframe = AggregationPeriod.FIFTEEN_MIN; #, title="Timeframe", group=groupMesa)
input showMesaMovAvg = yes; #(true, title='MESA MA', group=groupMesa)
input mesaSource = close;
input mesaFastLimit = 0.25;
input mesaSlowLimit = 0.05;
input showBackgroundSignals = no; #  "Background Signals",
input signalTimeframe1 = AggregationPeriod.FIFTEEN_MIN;
input signalTimeframe2 = AggregationPeriod.FOUR_HOURS;


def na = Double.NaN;
def pos = Double.POSITIVE_INFINITY;
def neg = Double.NEGATIVE_INFINITY;
def current = GetAggregationPeriod();
def tf1 = Max(mesaHigherTimeframe, current);
#def src1 = close(Period = tf1);

#-- Color
DefineGlobalColor("mamaCol", CreateColor(64, 224, 208));
DefineGlobalColor("famaCol", CreateColor(255, 127, 80));
DefineGlobalColor("cloudBull", CreateColor(152, 251, 152));
DefineGlobalColor("cloudBear", CreateColor(255, 192, 203));

script nz {
    input data  = close;
    input repl = 0;
    def ret_val = if isNaN(data) then repl else
                  if data==0 then repl else data;
    plot return = ret_val;
}
script getMESA {
    input Src = close;
    input FastLimit = 0.25;
    input SlowLimit = 0.05;
    def bar = CompoundValue(1, BarNumber(), 0);
    def na = Double.NaN;
    def PI = 3.14159;
    def Period; def Period0; def Period1; def Period2; def MAMA; def FAMA; def Smooth; def Designaler;
    def Q1; def I1; def jI; def jQ; def I2; def Q2; def Re; def Im; def Phase; def DeltaPhase; def alpha;
    Smooth = (4 * src + 3 * src[1] + 2 * src[2] + src[3]) / 10;
    Designaler = (0.0962 * Smooth + 0.5769 * Smooth[2] - 0.5769 * Smooth[4] -
                  0.0962 * Smooth[6]) * (0.075 * nz(Period[1], 1) + 0.54);
    Q1 = (0.0962 * Designaler + 0.5769 * Designaler[2] - 0.5769 * Designaler[4] -
          0.0962 * Designaler[6]) * (0.075 * nz(Period[1], 1) + 0.54);
    I1 = Designaler[3];
    jI = (0.0962 * I1 + 0.5769 * I1[2] - 0.5769 * I1[4] - 0.0962 * I1[6]) * (0.075 * nz(Period[1], 1) + 0.54);
    jQ = (0.0962 * Q1 + 0.5769 * Q1[2] - 0.5769 * Q1[4] - 0.0962 * Q1[6]) * (0.075 * nz(Period[1], 1) + 0.54);
    I2 = 0.2 * (I1 - jQ) + 0.8 * I2[1];
    Q2 = 0.2 * (Q1 + jI) + 0.8 * Q2[1];
    Re = 0.2 * (I2 * I2[1] + Q2 * Q2[1]) + 0.8 * Re[1];
    Im = 0.2 * (I2 * Q2[1] - Q2 * I2[1]) + 0.8 * Im[1];
    Period0 = if Im != 0 and Re != 0 then 2 * PI / atan(Im / Re) else nz(Period[1], 1);
    Period1 = min(min(Period0, 1.5 * Period1[1]), 50);
    Period2 = max(max(Period1 , 0.67 * Period2[1]), 6);
    Period = 0.2 * Period2 + 0.8 * Period[1];
    Phase = if I1 != 0 then 180 / PI * atan(Q1 / I1) else 0;
    DeltaPhase = Max((nz(Phase[1]) - Phase), 1);
    alpha = Min(Max(FastLimit / DeltaPhase, SlowLimit), FastLimit);
    MAMA = alpha * src + (1 - alpha) * nz(MAMA[1], src);
    FAMA = 0.5 * alpha * MAMA + (1 - 0.5 * alpha) * nz(FAMA[1], src);
    def cond =  bar > 5 and !isNaN(close);
    plot ma = if cond and MAMA then MAMA else na;
    plot fa = if cond and FAMA then FAMA else na;
}

#// Current timeframe MAs
def MAMA = getMESA(mesaSource, mesaFastLimit, mesaSlowLimit).ma;
def FAMA = getMESA(mesaSource, mesaFastLimit, mesaSlowLimit).fa;
#// User defined higher timeframe MAs
def HTF_MAMA = getMESA(close(Period = tf1), mesaFastLimit, mesaSlowLimit).ma;
def HTF_FAMA = getMESA(close(Period = tf1), mesaFastLimit, mesaSlowLimit).fa;

#cloudColors = MAMA > FAMA ? cloudBull : cloudBear
AssignPriceColor(if !ColoredBars then Color.CURRENT else
                 if MAMA > FAMA then GlobalColor("cloudBull") else GlobalColor("cloudBear"));

plot p_MAMA = if showMesaMovAvg then MAMA else na; #, "MAMA"
plot p_FAMA = if showMesaMovAvg then FAMA else na; #, "FAMA"
plot p_HTF_MAMA = if showHigherTimeframeMESA then HTF_MAMA else na; #, "MAMA Higher TF"
plot p_HTF_FAMA = if showHigherTimeframeMESA then HTF_FAMA else na; #, "FAMA Higher TF"
p_MAMA.SetDefaultColor(GlobalColor("mamaCol"));
p_FAMA.SetDefaultColor(GlobalColor("famaCol"));
p_HTF_MAMA.SetDefaultColor(GlobalColor("mamaCol"));
p_HTF_FAMA.SetDefaultColor(GlobalColor("famaCol"));

AddCloud(p_MAMA, p_FAMA, Color.DARK_GREEN, Color.DARK_RED);
AddCloud(p_HTF_MAMA, p_HTF_FAMA, Color.DARK_GREEN, Color.DARK_RED);

# // --- MESA Strategies
def tf2 = Max(current, signalTimeframe1);
def tf3 = Max(current, signalTimeframe2);

def hama_15m = getMESA(close(Period = tf2), mesaFastLimit, mesaSlowLimit).ma;
def hfa_15m = getMESA(close(Period = tf2), mesaFastLimit, mesaSlowLimit).fa;
def hfa_4h = getMESA( close(Period = tf3), mesaFastLimit, mesaSlowLimit).fa;

def isUptrend = hama_15m > hfa_4h;
def entryCondition = isUptrend and (hama_15m > hfa_15m);
def exitCondition = !isUptrend or (hama_15m < hfa_15m);

plot mama15 = hama_15m; # "MAMA 15m"
plot fama15 = hfa_15m;  # "FAMA 15m"
MAMA15.SetDefaultColor(Color.GREEN);
FAMA15.SetDefaultColor(Color.RED);

AddCloud(if showBackgroundSignals and entryCondition then pos else na, neg, Color.DARK_GREEN);
AddCloud(if showBackgroundSignals and exitCondition then pos else na, neg, Color.DARK_RED);

#// Wavesignal Zone by VuManChu
input wtMASource = hlc3;     # 'WT MA Source'
input wtChannelLen = 9;      # 'WT Channel Length'
input wtAverageLen = 12;     # 'WT Average Length'
input wtMALen = 3;           # 'WT MA Length'
input obLevel1 = 40; #, title='WT OB 1'
input obLevel2 = 60; #, title='WT OB 2'
input obLevel3 = 75; #, title='WT OB 3'
input osLevel1 = -40; #, title='WT OS 1'
input osLevel2 = -60; #, title='WT OS 2'
input osLevel3 = -75; #, title='WT OS 3'
input lev1Sig = no; #, title='Level 1 Signals'
input lev2Sig = no; #, title='Level 2 Signals'
input lev3Sig = yes; #, title='Level 3 Signals'

DefineGlobalColor("WTB1", CreateColor(255, 251, 0));
DefineGlobalColor("WTS1", CreateColor(255, 157, 0));
DefineGlobalColor("WTB2", CreateColor(157, 255, 0));
DefineGlobalColor("WTS2", CreateColor(255, 132, 0));
DefineGlobalColor("WTB3", CreateColor(50, 168, 74));
DefineGlobalColor("WTS3", Color.RED);

Script f_wavesignal {
input src = hlc3;
input chlen = 9;
input avg = 12;
input malen = 3;
    def esa = ExpAverage(src, chlen);
    def de = ExpAverage(AbsValue(src - esa), chlen);
    def ci = (src - esa) / (0.015 * de);
    def wt1 = ExpAverage(ci, avg);
    def wt2 = Average(wt1, malen);
    plot w1 = wt1;
    plot w2 = wt2;
}
def wt1 = f_wavesignal(wtMASource, wtChannelLen, wtAverageLen, wtMALen).w1;
def wt2 = f_wavesignal(wtMASource, wtChannelLen, wtAverageLen, wtMALen).w2;
def crossAbove = (wt1 Crosses Above wt2);
def crossUnder = (wt1 Crosses Below wt2);
def lev1Buy  = crossAbove and wt1 <= osLevel1 and wt1 > osLevel2;
def lev1Sell = crossUnder and wt1 >= obLevel1 and wt1 < obLevel2;
def lev2Buy  = crossAbove and wt1 <= osLevel2 and wt1 > osLevel3;
def lev2Sell = crossUnder and wt1 >= obLevel2 and wt1 < obLevel3;
def lev3Buy  = crossAbove and wt1 <= osLevel3;
def lev3Sell = crossUnder and wt1 >= obLevel3;

AssignPriceColor(if !ColoredBars then if lev3Buy then Color.CYAN else
                 if lev3Sell then Color.MAGENTA else Color.CURRENT else Color.CURRENt);

plot WTB1 = if lev1Sig then if lev1Buy then 1 else na else na;
plot WTS1 = if lev1Sig then if lev1Sell then 1 else na else na;
plot WTB2 = if lev2Sig then if lev2Buy then 2 else na else na;
plot WTS2 = if lev2Sig then if lev2Sell then 2 else na else na;
plot WTB3 = if lev3Sig then if lev3Buy then 3 else na else na;
plot WTS3 = if lev3Sig then if lev3Sell then 3 else na else na;
WTB1.SetLineWeight(2);
WTS1.SetLineWeight(2);
WTB2.SetLineWeight(2);
WTS2.SetLineWeight(2);
WTB3.SetLineWeight(2);
WTS3.SetLineWeight(2);
WTB1.SetPaintingStrategy(PaintingStrategy.VALUES_BELOW);
WTS1.SetPaintingStrategy(PaintingStrategy.VALUES_ABOVE);
WTB2.SetPaintingStrategy(PaintingStrategy.VALUES_BELOW);
WTS2.SetPaintingStrategy(PaintingStrategy.VALUES_ABOVE);
WTB3.SetPaintingStrategy(PaintingStrategy.VALUES_BELOW);
WTS3.SetPaintingStrategy(PaintingStrategy.VALUES_ABOVE);
WTB1.SetDefaultColor(GlobalColor("WTB1"));
WTS1.SetDefaultColor(GlobalColor("WTS1"));
WTB2.SetDefaultColor(GlobalColor("WTB2"));
WTS2.SetDefaultColor(GlobalColor("WTS2"));
WTB3.SetDefaultColor(GlobalColor("WTB3"));
WTS3.SetDefaultColor(GlobalColor("WTS3"));

#// Exhaustion by inSilico
input showSuppResLines = yes;         # 'Show S/R Lines?'
input exhaustionSource = close;       # "Source"
input exhaustionSwingLength = 40;     # "Swing Length"
input exhaustionBarCount = 10;        # "Bar Count"
input exhaustionBarsBack = 4;         # "Bars Back"

Script exhaustion {
input BARS = 10;
input SWING_LEN = 40;
input B_BACK = 4;
input SRC = close;
    def bullCount; def bearCount;def ret;
    def bullCnt = if SRC > SRC[B_BACK] then bullCount[1] + 1 else bullCount[1];
    def bearCnt = if SRC < SRC[B_BACK] then bearCount[1] + 1 else bearCount[1];
    def lowest_ = lowest(low, SWING_LEN);
    def highest_ = highest(high, SWING_LEN);
    
    if(bullCnt > BARS and close < open and high >= highest_) {
        bullCount = 0;
        bearCount = bearCnt;
        ret = -1;
    } else if(bearCnt > BARS and close > open and low <= lowest_) {
        bullCount = bullCnt;
        bearCount = 0;
        ret = 1;
    } else {
        bullCount = bullCnt;
        bearCount = bearCnt;
        ret = 0;
}
    plot sig = if isNaN(ret) then 0 else ret;
}
def signal = exhaustion(exhaustionBarCount, exhaustionSwingLength, exhaustionBarsBack, exhaustionSource);

def top = if signal == -1 then high else na;
def bottom = if signal == 1 then low else na;

def resistance = if close < open and signal then high else resistance[1];
def support = if close > open and signal then low else support[1];

def resColor = (resistance - resistance[-1]) == 0;
def supColor = (support - support[-1]) == 0;

AddChartBubble(showSuppResLines and bottom, low, "S", Color.CYAN, no);
AddChartBubble(showSuppResLines and top, high, "R", Color.MAGENTA);

#-- bounce
input bounceLookback = 3; #  // Number of bars to check for a bounce after touching the level

Script priceTestBounce {
input SUPPORT = low;
input RESISTANCE = high;
input BARS_AFTER_TOUCH = 3;
    def touchedSupport = if low <= SUPPORT and high >= SUPPORT then yes else touchedSupport[1];
    def touchedResistance = if high >= RESISTANCE and low <= RESISTANCE then yes else touchedResistance[1];
    def ll = lowest(low, BARS_AFTER_TOUCH);
    def hh = highest(high, BARS_AFTER_TOUCH);
    def bouncedFromSupp = touchedSupport and close > SUPPORT and ll[1] <= SUPPORT and hh[1] >= SUPPORT;
    def bouncedFromRes = touchedResistance and close < RESISTANCE and hh[1] >= RESISTANCE and ll[1] <= RESISTANCE;
    plot sup = bouncedFromSupp;
    plot Res = bouncedFromRes;
}

def bouncedFromSupport = priceTestBounce(support, resistance, bounceLookback).sup;
def bouncedFromResistance = priceTestBounce(support, resistance, bounceLookback).res;


plot ResLevel = if showSuppResLines and resColor and resistance then resistance else na; # "Resistance Level"
plot SupLevel = if showSuppResLines and supColor and support then support else na; # "Support Level"
ResLevel.AssignValueColor(if bouncedFromResistance then GlobalColor("WTB1") else Color.MAGENTA);
SupLevel.AssignValueColor(if bouncedFromSupport then GlobalColor("WTB1") else Color.CYAN);

#-- END of CODE
 
check the below:

CSS:
#https://www.tradingview.com/v/16Da1RcQ/
#//@copeharder
#indicator(title="Trade Suite", shorttitle="tsuite", overlay=true)
#// MESA Moving Average by John Ehlers
# - converted by Sam4Cok@Samer800    - 06/2024
input ColoredBars = yes; #(true, title='MESA MA Colored Bars?', group=groupMesa)
input showHigherTimeframeMESA = no; #(false, title="Show MESA for selected higher timeframes", group=groupMesa)
input mesaHigherTimeframe = AggregationPeriod.FIFTEEN_MIN; #, title="Timeframe", group=groupMesa)
input showMesaMovAvg = yes; #(true, title='MESA MA', group=groupMesa)
input mesaSource = close;
input mesaFastLimit = 0.25;
input mesaSlowLimit = 0.05;
input showBackgroundSignals = no; #  "Background Signals",
input signalTimeframe1 = AggregationPeriod.FIFTEEN_MIN;
input signalTimeframe2 = AggregationPeriod.FOUR_HOURS;


def na = Double.NaN;
def pos = Double.POSITIVE_INFINITY;
def neg = Double.NEGATIVE_INFINITY;
def current = GetAggregationPeriod();
def tf1 = Max(mesaHigherTimeframe, current);
#def src1 = close(Period = tf1);

#-- Color
DefineGlobalColor("mamaCol", CreateColor(64, 224, 208));
DefineGlobalColor("famaCol", CreateColor(255, 127, 80));
DefineGlobalColor("cloudBull", CreateColor(152, 251, 152));
DefineGlobalColor("cloudBear", CreateColor(255, 192, 203));

script nz {
    input data  = close;
    input repl = 0;
    def ret_val = if isNaN(data) then repl else
                  if data==0 then repl else data;
    plot return = ret_val;
}
script getMESA {
    input Src = close;
    input FastLimit = 0.25;
    input SlowLimit = 0.05;
    def bar = CompoundValue(1, BarNumber(), 0);
    def na = Double.NaN;
    def PI = 3.14159;
    def Period; def Period0; def Period1; def Period2; def MAMA; def FAMA; def Smooth; def Designaler;
    def Q1; def I1; def jI; def jQ; def I2; def Q2; def Re; def Im; def Phase; def DeltaPhase; def alpha;
    Smooth = (4 * src + 3 * src[1] + 2 * src[2] + src[3]) / 10;
    Designaler = (0.0962 * Smooth + 0.5769 * Smooth[2] - 0.5769 * Smooth[4] -
                  0.0962 * Smooth[6]) * (0.075 * nz(Period[1], 1) + 0.54);
    Q1 = (0.0962 * Designaler + 0.5769 * Designaler[2] - 0.5769 * Designaler[4] -
          0.0962 * Designaler[6]) * (0.075 * nz(Period[1], 1) + 0.54);
    I1 = Designaler[3];
    jI = (0.0962 * I1 + 0.5769 * I1[2] - 0.5769 * I1[4] - 0.0962 * I1[6]) * (0.075 * nz(Period[1], 1) + 0.54);
    jQ = (0.0962 * Q1 + 0.5769 * Q1[2] - 0.5769 * Q1[4] - 0.0962 * Q1[6]) * (0.075 * nz(Period[1], 1) + 0.54);
    I2 = 0.2 * (I1 - jQ) + 0.8 * I2[1];
    Q2 = 0.2 * (Q1 + jI) + 0.8 * Q2[1];
    Re = 0.2 * (I2 * I2[1] + Q2 * Q2[1]) + 0.8 * Re[1];
    Im = 0.2 * (I2 * Q2[1] - Q2 * I2[1]) + 0.8 * Im[1];
    Period0 = if Im != 0 and Re != 0 then 2 * PI / atan(Im / Re) else nz(Period[1], 1);
    Period1 = min(min(Period0, 1.5 * Period1[1]), 50);
    Period2 = max(max(Period1 , 0.67 * Period2[1]), 6);
    Period = 0.2 * Period2 + 0.8 * Period[1];
    Phase = if I1 != 0 then 180 / PI * atan(Q1 / I1) else 0;
    DeltaPhase = Max((nz(Phase[1]) - Phase), 1);
    alpha = Min(Max(FastLimit / DeltaPhase, SlowLimit), FastLimit);
    MAMA = alpha * src + (1 - alpha) * nz(MAMA[1], src);
    FAMA = 0.5 * alpha * MAMA + (1 - 0.5 * alpha) * nz(FAMA[1], src);
    def cond =  bar > 5 and !isNaN(close);
    plot ma = if cond and MAMA then MAMA else na;
    plot fa = if cond and FAMA then FAMA else na;
}

#// Current timeframe MAs
def MAMA = getMESA(mesaSource, mesaFastLimit, mesaSlowLimit).ma;
def FAMA = getMESA(mesaSource, mesaFastLimit, mesaSlowLimit).fa;
#// User defined higher timeframe MAs
def HTF_MAMA = getMESA(close(Period = tf1), mesaFastLimit, mesaSlowLimit).ma;
def HTF_FAMA = getMESA(close(Period = tf1), mesaFastLimit, mesaSlowLimit).fa;

#cloudColors = MAMA > FAMA ? cloudBull : cloudBear
AssignPriceColor(if !ColoredBars then Color.CURRENT else
                 if MAMA > FAMA then GlobalColor("cloudBull") else GlobalColor("cloudBear"));

plot p_MAMA = if showMesaMovAvg then MAMA else na; #, "MAMA"
plot p_FAMA = if showMesaMovAvg then FAMA else na; #, "FAMA"
plot p_HTF_MAMA = if showHigherTimeframeMESA then HTF_MAMA else na; #, "MAMA Higher TF"
plot p_HTF_FAMA = if showHigherTimeframeMESA then HTF_FAMA else na; #, "FAMA Higher TF"
p_MAMA.SetDefaultColor(GlobalColor("mamaCol"));
p_FAMA.SetDefaultColor(GlobalColor("famaCol"));
p_HTF_MAMA.SetDefaultColor(GlobalColor("mamaCol"));
p_HTF_FAMA.SetDefaultColor(GlobalColor("famaCol"));

AddCloud(p_MAMA, p_FAMA, Color.DARK_GREEN, Color.DARK_RED);
AddCloud(p_HTF_MAMA, p_HTF_FAMA, Color.DARK_GREEN, Color.DARK_RED);

# // --- MESA Strategies
def tf2 = Max(current, signalTimeframe1);
def tf3 = Max(current, signalTimeframe2);

def hama_15m = getMESA(close(Period = tf2), mesaFastLimit, mesaSlowLimit).ma;
def hfa_15m = getMESA(close(Period = tf2), mesaFastLimit, mesaSlowLimit).fa;
def hfa_4h = getMESA( close(Period = tf3), mesaFastLimit, mesaSlowLimit).fa;

def isUptrend = hama_15m > hfa_4h;
def entryCondition = isUptrend and (hama_15m > hfa_15m);
def exitCondition = !isUptrend or (hama_15m < hfa_15m);

plot mama15 = hama_15m; # "MAMA 15m"
plot fama15 = hfa_15m;  # "FAMA 15m"
MAMA15.SetDefaultColor(Color.GREEN);
FAMA15.SetDefaultColor(Color.RED);

AddCloud(if showBackgroundSignals and entryCondition then pos else na, neg, Color.DARK_GREEN);
AddCloud(if showBackgroundSignals and exitCondition then pos else na, neg, Color.DARK_RED);

#// Wavesignal Zone by VuManChu
input wtMASource = hlc3;     # 'WT MA Source'
input wtChannelLen = 9;      # 'WT Channel Length'
input wtAverageLen = 12;     # 'WT Average Length'
input wtMALen = 3;           # 'WT MA Length'
input obLevel1 = 40; #, title='WT OB 1'
input obLevel2 = 60; #, title='WT OB 2'
input obLevel3 = 75; #, title='WT OB 3'
input osLevel1 = -40; #, title='WT OS 1'
input osLevel2 = -60; #, title='WT OS 2'
input osLevel3 = -75; #, title='WT OS 3'
input lev1Sig = no; #, title='Level 1 Signals'
input lev2Sig = no; #, title='Level 2 Signals'
input lev3Sig = yes; #, title='Level 3 Signals'

DefineGlobalColor("WTB1", CreateColor(255, 251, 0));
DefineGlobalColor("WTS1", CreateColor(255, 157, 0));
DefineGlobalColor("WTB2", CreateColor(157, 255, 0));
DefineGlobalColor("WTS2", CreateColor(255, 132, 0));
DefineGlobalColor("WTB3", CreateColor(50, 168, 74));
DefineGlobalColor("WTS3", Color.RED);

Script f_wavesignal {
input src = hlc3;
input chlen = 9;
input avg = 12;
input malen = 3;
    def esa = ExpAverage(src, chlen);
    def de = ExpAverage(AbsValue(src - esa), chlen);
    def ci = (src - esa) / (0.015 * de);
    def wt1 = ExpAverage(ci, avg);
    def wt2 = Average(wt1, malen);
    plot w1 = wt1;
    plot w2 = wt2;
}
def wt1 = f_wavesignal(wtMASource, wtChannelLen, wtAverageLen, wtMALen).w1;
def wt2 = f_wavesignal(wtMASource, wtChannelLen, wtAverageLen, wtMALen).w2;
def crossAbove = (wt1 Crosses Above wt2);
def crossUnder = (wt1 Crosses Below wt2);
def lev1Buy  = crossAbove and wt1 <= osLevel1 and wt1 > osLevel2;
def lev1Sell = crossUnder and wt1 >= obLevel1 and wt1 < obLevel2;
def lev2Buy  = crossAbove and wt1 <= osLevel2 and wt1 > osLevel3;
def lev2Sell = crossUnder and wt1 >= obLevel2 and wt1 < obLevel3;
def lev3Buy  = crossAbove and wt1 <= osLevel3;
def lev3Sell = crossUnder and wt1 >= obLevel3;

AssignPriceColor(if !ColoredBars then if lev3Buy then Color.CYAN else
                 if lev3Sell then Color.MAGENTA else Color.CURRENT else Color.CURRENt);

plot WTB1 = if lev1Sig then if lev1Buy then 1 else na else na;
plot WTS1 = if lev1Sig then if lev1Sell then 1 else na else na;
plot WTB2 = if lev2Sig then if lev2Buy then 2 else na else na;
plot WTS2 = if lev2Sig then if lev2Sell then 2 else na else na;
plot WTB3 = if lev3Sig then if lev3Buy then 3 else na else na;
plot WTS3 = if lev3Sig then if lev3Sell then 3 else na else na;
WTB1.SetLineWeight(2);
WTS1.SetLineWeight(2);
WTB2.SetLineWeight(2);
WTS2.SetLineWeight(2);
WTB3.SetLineWeight(2);
WTS3.SetLineWeight(2);
WTB1.SetPaintingStrategy(PaintingStrategy.VALUES_BELOW);
WTS1.SetPaintingStrategy(PaintingStrategy.VALUES_ABOVE);
WTB2.SetPaintingStrategy(PaintingStrategy.VALUES_BELOW);
WTS2.SetPaintingStrategy(PaintingStrategy.VALUES_ABOVE);
WTB3.SetPaintingStrategy(PaintingStrategy.VALUES_BELOW);
WTS3.SetPaintingStrategy(PaintingStrategy.VALUES_ABOVE);
WTB1.SetDefaultColor(GlobalColor("WTB1"));
WTS1.SetDefaultColor(GlobalColor("WTS1"));
WTB2.SetDefaultColor(GlobalColor("WTB2"));
WTS2.SetDefaultColor(GlobalColor("WTS2"));
WTB3.SetDefaultColor(GlobalColor("WTB3"));
WTS3.SetDefaultColor(GlobalColor("WTS3"));

#// Exhaustion by inSilico
input showSuppResLines = yes;         # 'Show S/R Lines?'
input exhaustionSource = close;       # "Source"
input exhaustionSwingLength = 40;     # "Swing Length"
input exhaustionBarCount = 10;        # "Bar Count"
input exhaustionBarsBack = 4;         # "Bars Back"

Script exhaustion {
input BARS = 10;
input SWING_LEN = 40;
input B_BACK = 4;
input SRC = close;
    def bullCount; def bearCount;def ret;
    def bullCnt = if SRC > SRC[B_BACK] then bullCount[1] + 1 else bullCount[1];
    def bearCnt = if SRC < SRC[B_BACK] then bearCount[1] + 1 else bearCount[1];
    def lowest_ = lowest(low, SWING_LEN);
    def highest_ = highest(high, SWING_LEN);
   
    if(bullCnt > BARS and close < open and high >= highest_) {
        bullCount = 0;
        bearCount = bearCnt;
        ret = -1;
    } else if(bearCnt > BARS and close > open and low <= lowest_) {
        bullCount = bullCnt;
        bearCount = 0;
        ret = 1;
    } else {
        bullCount = bullCnt;
        bearCount = bearCnt;
        ret = 0;
}
    plot sig = if isNaN(ret) then 0 else ret;
}
def signal = exhaustion(exhaustionBarCount, exhaustionSwingLength, exhaustionBarsBack, exhaustionSource);

def top = if signal == -1 then high else na;
def bottom = if signal == 1 then low else na;

def resistance = if close < open and signal then high else resistance[1];
def support = if close > open and signal then low else support[1];

def resColor = (resistance - resistance[-1]) == 0;
def supColor = (support - support[-1]) == 0;

AddChartBubble(showSuppResLines and bottom, low, "S", Color.CYAN, no);
AddChartBubble(showSuppResLines and top, high, "R", Color.MAGENTA);

#-- bounce
input bounceLookback = 3; #  // Number of bars to check for a bounce after touching the level

Script priceTestBounce {
input SUPPORT = low;
input RESISTANCE = high;
input BARS_AFTER_TOUCH = 3;
    def touchedSupport = if low <= SUPPORT and high >= SUPPORT then yes else touchedSupport[1];
    def touchedResistance = if high >= RESISTANCE and low <= RESISTANCE then yes else touchedResistance[1];
    def ll = lowest(low, BARS_AFTER_TOUCH);
    def hh = highest(high, BARS_AFTER_TOUCH);
    def bouncedFromSupp = touchedSupport and close > SUPPORT and ll[1] <= SUPPORT and hh[1] >= SUPPORT;
    def bouncedFromRes = touchedResistance and close < RESISTANCE and hh[1] >= RESISTANCE and ll[1] <= RESISTANCE;
    plot sup = bouncedFromSupp;
    plot Res = bouncedFromRes;
}

def bouncedFromSupport = priceTestBounce(support, resistance, bounceLookback).sup;
def bouncedFromResistance = priceTestBounce(support, resistance, bounceLookback).res;


plot ResLevel = if showSuppResLines and resColor and resistance then resistance else na; # "Resistance Level"
plot SupLevel = if showSuppResLines and supColor and support then support else na; # "Support Level"
ResLevel.AssignValueColor(if bouncedFromResistance then GlobalColor("WTB1") else Color.MAGENTA);
SupLevel.AssignValueColor(if bouncedFromSupport then GlobalColor("WTB1") else Color.CYAN);

#-- END of CODE
Nice job! I'm not a coder, but I see the potential in learning what parts of this script do. BTW, do your moving averages flicker on and off?
 
Nice job! I'm not a coder, but I see the potential in learning what parts of this script do. BTW, do your moving averages flicker on and off?

You will see the MTF moving averages repaint until the higher aggregation candle closes.
This can manifest as "flickering on and off"
 
Last edited:
Leledc Exhaustion is the fascinating stock theory creating these S & R lines.
No, you can not count on them to move, as you have suggested.
Unfortunately, a short-coming to Leledc Exhaustion is that sometimes, they don't move at all.

It actually takes a whole book to understand how the support and resistance lines based on Leledc Exhaustion is calculated.
No, it is not as simplistic as your description.
Google Leledc Exhaustion Indicator for information on how these support and resistance levels are being devised, in order to understand the pros and cons of this snippet of code.
Could you please look at the code and offer another, possibly better, way to have the support and resistance lines move as suggested? BTW, I just changed the time of the chart from 90D:4Hr to 10D:10Min and the chart displayed accurate current support and resistance lines. Could there be a way to have the Leledic Exhaustion Indicator run on a shorter timeframe, while the rest of the script runs on a longer timeframe?

Edit: I played with the exhaustion swing length and bar count and found that a swing length of 2 and a bar count of 5 consistently gave the best support and resistance lines on a 4Hr chart.
 
Last edited:
Could you please look at the code and offer another, possibly better, way to have the support and resistance lines move as suggested? BTW, I just changed the time of the chart from 90D:4Hr to 10D:10Min and the chart displayed accurate current support and resistance lines. Could there be a way to have the Leledic Exhaustion Indicator run on a shorter timeframe, while the rest of the script runs on a longer timeframe?
yes, you can and should experiment with the input settings to best match indicators with your chart.

yes, you can add multiple instances of the indicator to your chart with different timeframes and turning on and off the plots that you want for each timeframe.
 

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
490 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