TraderOracle Method For ThinkOrSwim

serendipity2020

Member
Plus
This is one of the best TV code I've come across which makes good amount every day with futures. If someone like @samer800 can convert it to ToS, it would be super helpful!
https://www.tradingview.com/script/yE35zW1B-TraderOracle-Method/

It is a beginner guide to scalping NASDAQ 100 E-mini futures. Trades are taken based on recognizing volume spikes, squeezes, and candlestick patterns; combined with channel bands to provide support and resistance.

The method starts with a candle identified by a long lower shadow and a small real body at the top, indicating a significant price reversal. When that candle occurs in the lower band of an established upward trend, it is an indication that the next moves will be upwards.
This is what the OP calls: "a needle in the cloud."
R3IfEPM.png


 
Last edited by a moderator:

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

@samer800 Thanks for the reply! Primarily, I look for V symbol (referred to as Vodka shot in his trading), T (for trampoline), Diamond and Shark symbol. If you can help with these, I'd really appreciate it. This strategy easily earns $100 to $300 per day easily making use of both upper and lower charts but we can start conversion initially on these symbols and enhance it further.
the lower study is found:
https://usethinkscript.com/threads/sharkwavetrend-for-thinkorswim.17331/

The upper study, you may try this

CSS:
# @DaveTrade55
# indicator(title="TraderOracle Method", shorttitle="TO Method v1.6", overlay=true)
# Converted by Sam4Cok@Samer800    - 11/2023 - Request From UseThinkScript.com member


#// =-=-=  Nadaraya-Watson: Envelope (Non-Repainting) © jdehorty  =-=-=-=- //

input ShowResistanceCloud  = yes;    # "Show Resistance Cloud"
input LookbackWindow       = 256;    # 'Lookback Window'
input RelativeWeighting    = 3.50;   # 'Relative Weighting'
input StartRegressionAtBar = 30;     # "Start Regression at Bar"
input atrLength = 66;                # 'ATR Length'
input nearAtrFactor = 1.95;          # 'Near ATR Factor'
input farAtrFactor = 7.00;           # 'Far ATR Factor'

def na = Double.NaN;
def isconfirmed = !IsNaN(close);

Script rationalQuadratic {
input _src = close;
input _lookback = 256;
input _relativeWeight = 3.5;
input startAtBar = 30;
    def _size = if !isNaN(close) then 0 else 1;
    def _currentWeight = fold i = 0 to _size + startAtBar with p do
 p + GetValue(_src, i) * power(1 + (power(i, 2) / ((power(_lookback, 2) * 2 * _relativeWeight))), -_relativeWeight);
    def _cumulativeWeight = fold j = 0 to _size + startAtBar with q do
        q + power(1 + (power(j, 2) / ((power(_lookback, 2) * 2 * _relativeWeight))), -_relativeWeight);
    def yhat = _currentWeight / _cumulativeWeight;
    plot out = yhat;
}
Script getBounds {
input _atr = 1;
input _nearFactor = 1.95;
input _farFactor = 7.0;
input _yhat = close;
    def _upper_far = _yhat + _farFactor*_atr;
    def _upper_near = _yhat + _nearFactor*_atr;
    def _lower_near = _yhat - _nearFactor*_atr;
    def _lower_far = _yhat - _farFactor*_atr;
    def _upper_avg = (_upper_far + _upper_near) / 2;
    def _lower_avg = (_lower_far + _lower_near) / 2;
    plot upNear = _upper_near;
    plot upAvg = _upper_avg;
    plot loNear = _lower_near;
    plot loAvg = _lower_avg;
}
def yhat_close = rationalQuadratic(close, LookbackWindow, RelativeWeighting, StartRegressionAtBar);
def yhat_high = rationalQuadratic(high, LookbackWindow, RelativeWeighting, StartRegressionAtBar);
def yhat_low = rationalQuadratic(low, LookbackWindow, RelativeWeighting, StartRegressionAtBar);
def Kerneltr = TrueRange(yhat_high, yhat_close, yhat_low);
def ktr = WildersAverage(Kerneltr, atrLength);

def upper_near = getBounds(ktr, nearAtrFactor, farAtrFactor, yhat_close).upNear;
def upper_avg  = getBounds(ktr, nearAtrFactor, farAtrFactor, yhat_close).upAvg;
def lower_near = getBounds(ktr, nearAtrFactor, farAtrFactor, yhat_close).loNear;
def lower_avg  = getBounds(ktr, nearAtrFactor, farAtrFactor, yhat_close).loAvg;

def p_upper_avg  = if ShowResistanceCloud then upper_avg else na;    # 'Upper Boundary: Average'
def p_upper_near = if ShowResistanceCloud then upper_near else na;   # 'Upper Boundary: Near'
def p_lower_near = if ShowResistanceCloud then lower_near else na;   # 'Lower Boundary: Near'
def p_lower_avg  = if ShowResistanceCloud then lower_avg else na;    # 'Lower Boundary: Average'

AddCloud(p_upper_near, p_upper_avg, Color.DARK_RED, Color.DARK_RED, yes);        # 'Upper Boundary'
AddCloud(p_lower_near, p_lower_avg, Color.DARK_GREEN, Color.DARK_GREEN, yes);    # 'Lower Boundary'

#// =-=-=-=-=-=-=-=-=   Squeeze Relaxer version 2.1  =-
input ShowSqueezeRelaxerDots = yes;     # "Show Squeeze Relaxer Dots"
input SqueezeTolerance    = 2;          # "Squeeze Tolerance (lower = more sensitive)"
input adxSqueezeThreshold = 21;         # "ADX Threshold for TTM Squeeze"
input diLength            = 14;         # "DI Length"
input adxSmoothingLength  = 14;         # "ADX Smoothing"

#dirmov(len) =>
script adxDiMov {
    input dilen = 14;
    input adxlen = 14;
    def averageType = AverageType.WILDERS;
    def hiDiff = high - high[1];
    def loDiff = low[1] - low;
    def plusDM = if hiDiff > loDiff and hiDiff > 0 then hiDiff else 0;
    def minusDM =  if loDiff > hiDiff and loDiff > 0 then loDiff else 0;
    def ATR = MovingAverage(averageType, TrueRange(high, close, low), dilen);
    def plus = 100 * MovingAverage(averageType, plusDM, dilen) / ATR;
    def minus = 100 * MovingAverage(averageType, minusDM, dilen) / ATR;
    def DX = if (plus + minus > 0) then 100 * AbsValue(plus - minus) / (plus + minus) else 0;
    plot ADX = MovingAverage(averageType, DX, adxlen);
}

def adxValue = adxDiMov(diLength, adxSmoothingLength);
def sigabove19 = adxValue > adxSqueezeThreshold;

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

def sqlength = 20;
def multQ = 2.0;
def lengthKC = 20;
def multKC = 1.5;
def useTrueRange = yes;
def source = close;

def basis = Average(source, sqlength);
def dev1 = multKC * stdev(source, sqlength);
def upperBBsq = basis + dev1;
def lowerBBsq = basis - dev1;
def ma = Average(source, lengthKC);
def rangeQ = high - low;
def rangema = Average(rangeQ, lengthKC);
def upperKC = ma + rangema * multKC;
def lowerKC = ma - rangema * multKC;
def sqzOn  = (lowerBBsq > lowerKC) and (upperBBsq < upperKC);
def sqzOff = (lowerBBsq < lowerKC) and (upperBBsq > upperKC);
def noSqz  = (!sqzOn) and (!sqzOff);

def avg1 = (highest(high, lengthKC) + lowest(low, lengthKC)) / 2;
def avg2 = (avg1 + Average(close, lengthKC)) / 2;
def val = Inertia(close - avg2, lengthKC);

if (val < val[1] and val < 5 and !sqzOn) {
    cRed = cRed[1] + 1;
    cGreen = cGreen[1];
    pos = pos[1];
    neg = neg[1];
    } else
if (val > val[1] and val > 5 and !sqzOn) {
    cRed = cRed[1];
    cGreen = cGreen[1] + 1;
    pos = pos[1];
    neg = neg[1];
    } else
if (val > val[1] and cRed[1] > SqueezeTolerance and val < 5 and !pos[1] and sigabove19) {
    cRed = 0;
    cGreen = cGreen[1];
    pos  = yes;
    neg = neg[1];
    } else
if (val < val[1] and cGreen[1] > SqueezeTolerance and val > 5 and !neg[1] and sigabove19) {
    cRed = cRed[1];
    cGreen = 0;
    pos = pos[1];
    neg = yes;
    } else {
    cRed = cRed[1];
    cGreen = cGreen[1];
    pos = no;#pos[1];
    neg = no;#neg[1];
}
def buySignal1 = pos and isconfirmed;
def sellSignal1 = neg and isconfirmed;

 
plot sqBuy = if ShowSqueezeRelaxerDots and buySignal1 then low - ATR(30)/4 else na;     # "Squeeze Buy Signal"
plot sqSell = if ShowSqueezeRelaxerDots and sellSignal1 then high + ATR(30)/4 else na;  # "Squeeze Sell Signal"

sqBuy.SetLineWeight(2);
sqSell.SetLineWeight(2);
sqBuy.SetPaintingStrategy(PaintingStrategy.SQUARES);
sqSell.SetPaintingStrategy(PaintingStrategy.SQUARES);
sqBuy.SetDefaultColor(Color.YELLOW);
sqSell.SetDefaultColor(Color.YELLOW);

#// =--=-=-=-=-=   TRAMPOLINE  =-=-=-=-=-=-==-= //
#// Idea from "Serious Backtester" - https://www.youtube.com/watch?v=2hX7qTamOAQ
#// Defaults are optimized for 30 min candles
#// CONFIG
input ShowTrampoline     = yes;            # "Show Trampoline"
input BollingerLowerThreshold = 0.0015;    # "Bollinger Lower Threshold", Tip="0.003 for daily, 0.0015 for 30 min"
input RsiLowerThreshold = 25;              # "RSI Lower Threshold", tooltip="Normally 25"
input RsiUpperThreshold = 72;              # "RSI Upper Threshold", tooltip="Normally 75"
input rsiSource    = close;                # "RSI Source"
input rsiLength    = 14;                   # "RSI Length"
input bbSource     = close;                # "BBSource"
input bbLength     = 20;                   # "BB Length"
input bbMultiplier = 2.0;                  # "BB StdDev factor"
input bbOffset     = 0;                    # "BB Offset"

def isRed = close < open;
def isGreen = close > open;

#// BOLLINGER BANDS
def basisBB = Average(bbSource[bbOffset], bbLength);
def devBB = bbMultiplier * StDev(bbSource[bbOffset], bbLength);
def upperBB = basisBB + devBB;
def lowerBB = basisBB - devBB;
def downBB = low < lowerBB or high < lowerBB;
def upBB = low > upperBB or high > upperBB;
def bbw = (upperBB - lowerBB) / basisBB;

#// RSI
def rsiSrcChange = rsiSource - rsiSource[1];
def up = WildersAverage(Max(rsiSrcChange, 0), rsiLength);
def down = WildersAverage(-Min(rsiSrcChange, 0), rsiLength);
def rsiM = if down == 0 then 100 else if up == 0 then 0 else 100 - (100 / (1 + up / down));

def back1 = isRed[1] and rsiM[1] <= RsiLowerThreshold and
            close[1] < lowerBB[1] and bbw[1] > BollingerLowerThreshold;
def back2 = isRed[2] and rsiM[2] <= RsiLowerThreshold and
            close[2] < lowerBB[2] and bbw[2] > BollingerLowerThreshold;
def back3 = isRed[3] and rsiM[3] <= RsiLowerThreshold and
            close[3] < lowerBB[3] and bbw[3] > BollingerLowerThreshold;
def back4 = isRed[4] and rsiM[4] <= RsiLowerThreshold and
            close[4] < lowerBB[4] and bbw[4] > BollingerLowerThreshold;
def back5 = isRed[5] and rsiM[5] <= RsiLowerThreshold and
            close[5] < lowerBB[5] and bbw[5] > BollingerLowerThreshold;

def for1 = isGreen[1] and rsiM[1] >= RsiUpperThreshold and
            close[1] > upperBB[1] and bbw[1] > BollingerLowerThreshold;
def for2 = isGreen[2] and rsiM[2] >= RsiUpperThreshold and
            close[2] > upperBB[2] and bbw[2] > BollingerLowerThreshold;
def for3 = isGreen[3] and rsiM[3] >= RsiUpperThreshold and
            close[3] > upperBB[3] and bbw[3] > BollingerLowerThreshold;
def for4 = isGreen[4] and rsiM[4] >= RsiUpperThreshold and
            close[4] > upperBB[4] and bbw[4] > BollingerLowerThreshold;
def for5 = isGreen[5] and rsiM[5] >= RsiUpperThreshold and
            close[5] > upperBB[5] and bbw[5] > BollingerLowerThreshold;

def weGoUp = isGreen and (back1 or back2 or back3 or back4 or back5) and (high > high[1]) and isconfirmed;
def upThrust = weGoUp and !weGoUp[1] and !weGoUp[2] and !weGoUp[3] and !weGoUp[4];
def weGoDown = isRed and (for1 or for2 or for3 or for4 or for5) and (low < low[1]) and isconfirmed;
def downThrust = weGoDown and !weGoDown[1] and !weGoDown[2] and !weGoDown[3] and !weGoDown[4];

#// PLOT THE THINGS
AddChartBubble(ShowTrampoline and upThrust, low, "T", CreateColor(46, 173, 84), no);
AddChartBubble(ShowTrampoline and downThrust, high, "T", CreateColor(173, 46, 69));


#// ==-=-=-=-=   THE SHARK  =-=-=-=-=-=-=-=-=-=-=- //
input ShowSharkWedges = yes;    # "Show Shark Icons"
input applyRsiFilter  = no;     # "Apply 25/75 RSI rule"

def ema50 = ExpAverage(close, 50);
def ema200 = ExpAverage(close, 200);
def ema400 = ExpAverage(close, 400);
def ema800 = ExpAverage(close, 800);
def wapwap = Reference VWAP().VWAP;

def bTouchedLine = (ema50<high and ema50>low) or (ema200<high and ema200>low) or (ema400<high and ema400>low) or (ema800<high and ema800>low) or (wapwap<high and wapwap>low);

def basis5 = Average(rsiM, 30);
def dev = 2.0 * stdev(rsiM, 30);
def upper = basis5 + dev;
def lower = basis5 - dev;

def bBelow25 = if !applyRsiFilter then yes else rsiM < 26;
def bAbove75 = if !applyRsiFilter then yes else rsiM > 74;

def bShowSharkDown = (rsiM > upper and bAbove75) and isconfirmed;
def bShowSharkUp = (rsiM < lower and bBelow25) and isconfirmed;

plot SharkUp = if ShowSharkWedges and bShowSharkUp then low else na;
plot SharkDn = if ShowSharkWedges and bShowSharkDown then high else na;
SharkUp.SetLineWeight(2);
SharkDn.SetLineWeight(2);
SharkUp.SetPaintingStrategy(PaintingStrategy.BOOLEAN_WEDGE_DOWN);
SharkDn.SetPaintingStrategy(PaintingStrategy.BOOLEAN_WEDGE_UP);
SharkUp.SetDefaultColor(Color.CYAN);
SharkDn.SetDefaultColor(Color.MAGENTA);

#// ==============   VODKA SHOT
input ShowVodkaShot = yes;    # "Show VodkaShot"
input rlength  = 12;#, minval=1)
input DER_avg = 5;#, 'Average', minval=1, inline='DER', group='Directional Energy Ratio')
input MA_Type5 = {default "WMA", "EMA", "SMA"};#, 'DER MA type'
#input rsmooth  = 3;#, 'Smooth',
#input show_senti = yes;#, 'Sentiment',
#input senti   = 20;#, 'Length', minval=1, inline='DER_s', group='Directional Energy Ratio')
input VodkaShotCalcOptions = {default "Relative", "Full", "None"};#, 'Calculation'
input LookbackForRelative = 20;#, 'Lookback (for Relative)'


def isLong;# = false
def isShort;# = false

#// =====  NEGLECTED VOL by DGT  ==
def nzVolume = if IsNaN(volume) then 0 else volume;
#def obv = TotalSum(Sign(close - close[1]) * nzVolume);
#def source5  = if isconfirmed then close else close[1];
#def vsource  = if nzVolume then if isconfirmed then obv else obv[1] else na;
#def corr     = Correlation(source5, vsource, 14);
#def volAvgS  = Average(nzVolume, 14);
def volAvgL  = Average(nzVolume, 14 * 5);
def volDev   = (volAvgL + 1.618034 * StDev(volAvgL, 14 * 5)) / volAvgL * 11 / 100;
def volRel   = nzVolume / volAvgL;
#def momentum = (vsource - vsource[14]) / 14;
#def momOsc   = Inertia(momentum / volAvgS * 1.618034, 5);

#// =======  RedK Dual VADER with Energy Bars [VADER-DEB]
# stoch(source, high, low, length) =>
script stoch {
    input src = close;
    input h = high;
    input l = low;
    input len = 14;
    def hh = Highest(h, len);
    def ll = Lowest(l, len);
    def stoch = 100 * (src - ll) / (hh - ll);
    plot return = stoch;
}
script f_derma {
    input _data = close;
    input _len = 14;
    input MAOption = "SMA";
    def value =
      if MAOption == "SMA" then Average(_data, _len)  else
      if MAOption == "EMA" then ExpAverage(_data, _len) else WMA(_data, _len);
    plot out = value;
}

def v5 = if IsNaN(volume) then 1 else volume;
def stoch = stoch(v5, v5, v5, LookbackForRelative) / 100;
def vola    =
  if VodkaShotCalcOptions == VodkaShotCalcOptions."None" or IsNaN(volume) then 1 else
  if VodkaShotCalcOptions == VodkaShotCalcOptions."Relative" then stoch else v5;
def R       = (Highest(high, 2) - Lowest(low, 2)) / 2;
def sr      = (close - close[1]) / R;
def rsr     = Max(Min(sr, 1), -1);
def rsrVola = (rsr * vola);
def c       = if IsNaN(rsrVola) then c[1] else rsrVola;
def c_plus  =  Max(c, 0);
def c_minus = -Min(c, 0);

#def avg_vola    = f_derma(vola, rlength, MA_Type5);
def dem         = f_derma(c_plus, rlength, MA_Type5);
def sup         = f_derma(c_minus, rlength, MA_Type5);
def adp         = 100 * WMA(dem, DER_avg);
def asp         = 100 * WMA(sup, DER_avg);
#def anp         = adp - asp;
#def anp_s       = WMA(anp, rsmooth);

#def s_adp       = 100 * WMA(dem, senti);
#def s_asp       = 100 * WMA(sup, senti);
#def V_senti     = WMA(s_adp - s_asp, rsmooth);

#def up5      = anp_s >= 0;
#def s_up    = V_senti >= 0;

#def sflag_up = AbsValue(V_senti) >= AbsValue(V_senti[1]);

def bo = if IsNaN(asp) then bo[1] else asp;
def bc = if IsNaN(adp) then bc[1] else adp;
#def bh = Max(bo, bc);
#def bl = Min(bo, bc);

def rising = (bc - bc[1]) > 0;

def barcolor = if bc > bo and rising then 1 else
               if bc < bo and !rising then -1 else 0;

#// ====  RedK Slow_Smooth WMA, RSS_WMA v3 ====
#f_LazyLine(_data, _length) =>
script f_LazyLine {
    input _data = close;
    input _length = 14;
    def w = _length / 3;
    def w2;
    def w1;
    def w3;
    def L1;
    def L2;
    def L3;
    if _length > 2 {
        w2 = Round(w, 0);
        w1 = Round((_length - w2) / 2, 0);
        w3 = Floor((_length - w2) / 2);
        L1 = WMA(_data, w1);
        L2 = WMA(L1, w2);
        L3 = WMA(L2, w3);
    } else {
        w2 = 0;
        w1 = 0;
        w3 = 0;
        L1 = 0;
        L2 = 0;
        L3 = _data;
    }
    plot out = L3;
}

def LL = f_LazyLine(close, 21);

#def luptrend    = LL > LL[1];
#def SigMulti    = 1.0;

#def SignalOn = isconfirmed;
#def SwingDn  = luptrend[1] and !luptrend and isconfirmed;
#def SwingUp  = luptrend and !luptrend[1] and isconfirmed;

#def dl = SigMulti / 100 * LL;

def upwards = LL > LL[1] and (barcolor > 0) and up and (open < close and volRel * .145898 > volDev) and !isLong[1];
def downwards = LL < LL[1]  and (barcolor < 0) and (open > close and volRel * .145898 > volDev) and !isShort[1];

def showUp = upwards and !upwards[1] and !upwards[2] and !upwards[3] and !upwards[4];
def showDown = downwards and !downwards[1] and !upwards[2] and !upwards[3] and !upwards[4];

AddChartBubble(ShowVodkaShot and showUp, low, "V", Color.GREEN, no);
AddChartBubble(ShowVodkaShot and showDown, high, "V", Color.RED);

if showUp {
    isLong = yes;
    isShort = no;
} else
if showDown {
    isLong = no;
    isShort = yes;
} else {
    isLong = isLong[1];
    isShort = isShort[1];
}


#-- END of COE
 
Last edited by a moderator:
you may try this

CSS:
# @DaveTrade55
# indicator(title="TraderOracle Method", shorttitle="TO Method v1.6", overlay=true)
# Converted by Sam4Cok@Samer800    - 11/2023 - Request From UseThinkScript.com member


#// =-=-=  Nadaraya-Watson: Envelope (Non-Repainting) © jdehorty  =-=-=-=- //

input ShowResistanceCloud  = yes;    # "Show Resistance Cloud"
input LookbackWindow       = 256;    # 'Lookback Window'
input RelativeWeighting    = 3.50;   # 'Relative Weighting'
input StartRegressionAtBar = 30;     # "Start Regression at Bar"
input atrLength = 66;                # 'ATR Length'
input nearAtrFactor = 1.95;          # 'Near ATR Factor'
input farAtrFactor = 7.00;           # 'Far ATR Factor'

def na = Double.NaN;
def isconfirmed = !IsNaN(close);

Script rationalQuadratic {
input _src = close;
input _lookback = 256;
input _relativeWeight = 3.5;
input startAtBar = 30;
    def _size = if !isNaN(close) then 0 else 1;
    def _currentWeight = fold i = 0 to _size + startAtBar with p do
 p + GetValue(_src, i) * power(1 + (power(i, 2) / ((power(_lookback, 2) * 2 * _relativeWeight))), -_relativeWeight);
    def _cumulativeWeight = fold j = 0 to _size + startAtBar with q do
        q + power(1 + (power(j, 2) / ((power(_lookback, 2) * 2 * _relativeWeight))), -_relativeWeight);
    def yhat = _currentWeight / _cumulativeWeight;
    plot out = yhat;
}
Script getBounds {
input _atr = 1;
input _nearFactor = 1.95;
input _farFactor = 7.0;
input _yhat = close;
    def _upper_far = _yhat + _farFactor*_atr;
    def _upper_near = _yhat + _nearFactor*_atr;
    def _lower_near = _yhat - _nearFactor*_atr;
    def _lower_far = _yhat - _farFactor*_atr;
    def _upper_avg = (_upper_far + _upper_near) / 2;
    def _lower_avg = (_lower_far + _lower_near) / 2;
    plot upNear = _upper_near;
    plot upAvg = _upper_avg;
    plot loNear = _lower_near;
    plot loAvg = _lower_avg;
}
def yhat_close = rationalQuadratic(close, LookbackWindow, RelativeWeighting, StartRegressionAtBar);
def yhat_high = rationalQuadratic(high, LookbackWindow, RelativeWeighting, StartRegressionAtBar);
def yhat_low = rationalQuadratic(low, LookbackWindow, RelativeWeighting, StartRegressionAtBar);
def Kerneltr = TrueRange(yhat_high, yhat_close, yhat_low);
def ktr = WildersAverage(Kerneltr, atrLength);

def upper_near = getBounds(ktr, nearAtrFactor, farAtrFactor, yhat_close).upNear;
def upper_avg  = getBounds(ktr, nearAtrFactor, farAtrFactor, yhat_close).upAvg;
def lower_near = getBounds(ktr, nearAtrFactor, farAtrFactor, yhat_close).loNear;
def lower_avg  = getBounds(ktr, nearAtrFactor, farAtrFactor, yhat_close).loAvg;

def p_upper_avg  = if ShowResistanceCloud then upper_avg else na;    # 'Upper Boundary: Average'
def p_upper_near = if ShowResistanceCloud then upper_near else na;   # 'Upper Boundary: Near'
def p_lower_near = if ShowResistanceCloud then lower_near else na;   # 'Lower Boundary: Near'
def p_lower_avg  = if ShowResistanceCloud then lower_avg else na;    # 'Lower Boundary: Average'

AddCloud(p_upper_near, p_upper_avg, Color.DARK_RED, Color.DARK_RED, yes);        # 'Upper Boundary'
AddCloud(p_lower_near, p_lower_avg, Color.DARK_GREEN, Color.DARK_GREEN, yes);    # 'Lower Boundary'

#// =-=-=-=-=-=-=-=-=   Squeeze Relaxer version 2.1  =-
input ShowSqueezeRelaxerDots = yes;     # "Show Squeeze Relaxer Dots"
input SqueezeTolerance    = 2;          # "Squeeze Tolerance (lower = more sensitive)"
input adxSqueezeThreshold = 21;         # "ADX Threshold for TTM Squeeze"
input diLength            = 14;         # "DI Length"
input adxSmoothingLength  = 14;         # "ADX Smoothing"

#dirmov(len) =>
script adxDiMov {
    input dilen = 14;
    input adxlen = 14;
    def averageType = AverageType.WILDERS;
    def hiDiff = high - high[1];
    def loDiff = low[1] - low;
    def plusDM = if hiDiff > loDiff and hiDiff > 0 then hiDiff else 0;
    def minusDM =  if loDiff > hiDiff and loDiff > 0 then loDiff else 0;
    def ATR = MovingAverage(averageType, TrueRange(high, close, low), dilen);
    def plus = 100 * MovingAverage(averageType, plusDM, dilen) / ATR;
    def minus = 100 * MovingAverage(averageType, minusDM, dilen) / ATR;
    def DX = if (plus + minus > 0) then 100 * AbsValue(plus - minus) / (plus + minus) else 0;
    plot ADX = MovingAverage(averageType, DX, adxlen);
}

def adxValue = adxDiMov(diLength, adxSmoothingLength);
def sigabove19 = adxValue > adxSqueezeThreshold;

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

def sqlength = 20;
def multQ = 2.0;
def lengthKC = 20;
def multKC = 1.5;
def useTrueRange = yes;
def source = close;

def basis = Average(source, sqlength);
def dev1 = multKC * stdev(source, sqlength);
def upperBBsq = basis + dev1;
def lowerBBsq = basis - dev1;
def ma = Average(source, lengthKC);
def rangeQ = high - low;
def rangema = Average(rangeQ, lengthKC);
def upperKC = ma + rangema * multKC;
def lowerKC = ma - rangema * multKC;
def sqzOn  = (lowerBBsq > lowerKC) and (upperBBsq < upperKC);
def sqzOff = (lowerBBsq < lowerKC) and (upperBBsq > upperKC);
def noSqz  = (!sqzOn) and (!sqzOff);

def avg1 = (highest(high, lengthKC) + lowest(low, lengthKC)) / 2;
def avg2 = (avg1 + Average(close, lengthKC)) / 2;
def val = Inertia(close - avg2, lengthKC);

if (val < val[1] and val < 5 and !sqzOn) {
    cRed = cRed[1] + 1;
    cGreen = cGreen[1];
    pos = pos[1];
    neg = neg[1];
    } else
if (val > val[1] and val > 5 and !sqzOn) {
    cRed = cRed[1];
    cGreen = cGreen[1] + 1;
    pos = pos[1];
    neg = neg[1];
    } else
if (val > val[1] and cRed[1] > SqueezeTolerance and val < 5 and !pos[1] and sigabove19) {
    cRed = 0;
    cGreen = cGreen[1];
    pos  = yes;
    neg = neg[1];
    } else
if (val < val[1] and cGreen[1] > SqueezeTolerance and val > 5 and !neg[1] and sigabove19) {
    cRed = cRed[1];
    cGreen = 0;
    pos = pos[1];
    neg = yes;
    } else {
    cRed = cRed[1];
    cGreen = cGreen[1];
    pos = no;#pos[1];
    neg = no;#neg[1];
}
def buySignal1 = pos and isconfirmed;
def sellSignal1 = neg and isconfirmed;

 
plot sqBuy = if ShowSqueezeRelaxerDots and buySignal1 then low - ATR(30)/4 else na;     # "Squeeze Buy Signal"
plot sqSell = if ShowSqueezeRelaxerDots and sellSignal1 then high + ATR(30)/4 else na;  # "Squeeze Sell Signal"

sqBuy.SetLineWeight(2);
sqSell.SetLineWeight(2);
sqBuy.SetPaintingStrategy(PaintingStrategy.SQUARES);
sqSell.SetPaintingStrategy(PaintingStrategy.SQUARES);
sqBuy.SetDefaultColor(Color.YELLOW);
sqSell.SetDefaultColor(Color.YELLOW);

#// =--=-=-=-=-=   TRAMPOLINE  =-=-=-=-=-=-==-= //
#// Idea from "Serious Backtester" - https://www.youtube.com/watch?v=2hX7qTamOAQ
#// Defaults are optimized for 30 min candles
#// CONFIG
input ShowTrampoline     = yes;            # "Show Trampoline"
input BollingerLowerThreshold = 0.0015;    # "Bollinger Lower Threshold", Tip="0.003 for daily, 0.0015 for 30 min"
input RsiLowerThreshold = 25;              # "RSI Lower Threshold", tooltip="Normally 25"
input RsiUpperThreshold = 72;              # "RSI Upper Threshold", tooltip="Normally 75"
input rsiSource    = close;                # "RSI Source"
input rsiLength    = 14;                   # "RSI Length"
input bbSource     = close;                # "BBSource"
input bbLength     = 20;                   # "BB Length"
input bbMultiplier = 2.0;                  # "BB StdDev factor"
input bbOffset     = 0;                    # "BB Offset"

def isRed = close < open;
def isGreen = close > open;

#// BOLLINGER BANDS
def basisBB = Average(bbSource[bbOffset], bbLength);
def devBB = bbMultiplier * StDev(bbSource[bbOffset], bbLength);
def upperBB = basisBB + devBB;
def lowerBB = basisBB - devBB;
def downBB = low < lowerBB or high < lowerBB;
def upBB = low > upperBB or high > upperBB;
def bbw = (upperBB - lowerBB) / basisBB;

#// RSI
def rsiSrcChange = rsiSource - rsiSource[1];
def up = WildersAverage(Max(rsiSrcChange, 0), rsiLength);
def down = WildersAverage(-Min(rsiSrcChange, 0), rsiLength);
def rsiM = if down == 0 then 100 else if up == 0 then 0 else 100 - (100 / (1 + up / down));

def back1 = isRed[1] and rsiM[1] <= RsiLowerThreshold and
            close[1] < lowerBB[1] and bbw[1] > BollingerLowerThreshold;
def back2 = isRed[2] and rsiM[2] <= RsiLowerThreshold and
            close[2] < lowerBB[2] and bbw[2] > BollingerLowerThreshold;
def back3 = isRed[3] and rsiM[3] <= RsiLowerThreshold and
            close[3] < lowerBB[3] and bbw[3] > BollingerLowerThreshold;
def back4 = isRed[4] and rsiM[4] <= RsiLowerThreshold and
            close[4] < lowerBB[4] and bbw[4] > BollingerLowerThreshold;
def back5 = isRed[5] and rsiM[5] <= RsiLowerThreshold and
            close[5] < lowerBB[5] and bbw[5] > BollingerLowerThreshold;

def for1 = isGreen[1] and rsiM[1] >= RsiUpperThreshold and
            close[1] > upperBB[1] and bbw[1] > BollingerLowerThreshold;
def for2 = isGreen[2] and rsiM[2] >= RsiUpperThreshold and
            close[2] > upperBB[2] and bbw[2] > BollingerLowerThreshold;
def for3 = isGreen[3] and rsiM[3] >= RsiUpperThreshold and
            close[3] > upperBB[3] and bbw[3] > BollingerLowerThreshold;
def for4 = isGreen[4] and rsiM[4] >= RsiUpperThreshold and
            close[4] > upperBB[4] and bbw[4] > BollingerLowerThreshold;
def for5 = isGreen[5] and rsiM[5] >= RsiUpperThreshold and
            close[5] > upperBB[5] and bbw[5] > BollingerLowerThreshold;

def weGoUp = isGreen and (back1 or back2 or back3 or back4 or back5) and (high > high[1]) and isconfirmed;
def upThrust = weGoUp and !weGoUp[1] and !weGoUp[2] and !weGoUp[3] and !weGoUp[4];
def weGoDown = isRed and (for1 or for2 or for3 or for4 or for5) and (low < low[1]) and isconfirmed;
def downThrust = weGoDown and !weGoDown[1] and !weGoDown[2] and !weGoDown[3] and !weGoDown[4];

#// PLOT THE THINGS
AddChartBubble(ShowTrampoline and upThrust, low, "T", CreateColor(46, 173, 84), no);
AddChartBubble(ShowTrampoline and downThrust, high, "T", CreateColor(173, 46, 69));


#// ==-=-=-=-=   THE SHARK  =-=-=-=-=-=-=-=-=-=-=- //
input ShowSharkWedges = yes;    # "Show Shark Icons"
input applyRsiFilter  = no;     # "Apply 25/75 RSI rule"

def ema50 = ExpAverage(close, 50);
def ema200 = ExpAverage(close, 200);
def ema400 = ExpAverage(close, 400);
def ema800 = ExpAverage(close, 800);
def wapwap = Reference VWAP().VWAP;

def bTouchedLine = (ema50<high and ema50>low) or (ema200<high and ema200>low) or (ema400<high and ema400>low) or (ema800<high and ema800>low) or (wapwap<high and wapwap>low);

def basis5 = Average(rsiM, 30);
def dev = 2.0 * stdev(rsiM, 30);
def upper = basis5 + dev;
def lower = basis5 - dev;

def bBelow25 = if !applyRsiFilter then yes else rsiM < 26;
def bAbove75 = if !applyRsiFilter then yes else rsiM > 74;

def bShowSharkDown = (rsiM > upper and bAbove75) and isconfirmed;
def bShowSharkUp = (rsiM < lower and bBelow25) and isconfirmed;

plot SharkUp = if ShowSharkWedges and bShowSharkUp then low else na;
plot SharkDn = if ShowSharkWedges and bShowSharkDown then high else na;
SharkUp.SetLineWeight(2);
SharkDn.SetLineWeight(2);
SharkUp.SetPaintingStrategy(PaintingStrategy.BOOLEAN_WEDGE_DOWN);
SharkDn.SetPaintingStrategy(PaintingStrategy.BOOLEAN_WEDGE_UP);
SharkUp.SetDefaultColor(Color.CYAN);
SharkDn.SetDefaultColor(Color.MAGENTA);

#// ==============   VODKA SHOT
input ShowVodkaShot = yes;    # "Show VodkaShot"
input rlength  = 12;#, minval=1)
input DER_avg = 5;#, 'Average', minval=1, inline='DER', group='Directional Energy Ratio')
input MA_Type5 = {default "WMA", "EMA", "SMA"};#, 'DER MA type'
#input rsmooth  = 3;#, 'Smooth',
#input show_senti = yes;#, 'Sentiment',
#input senti   = 20;#, 'Length', minval=1, inline='DER_s', group='Directional Energy Ratio')
input VodkaShotCalcOptions = {default "Relative", "Full", "None"};#, 'Calculation'
input LookbackForRelative = 20;#, 'Lookback (for Relative)'


def isLong;# = false
def isShort;# = false

#// =====  NEGLECTED VOL by DGT  ==
def nzVolume = if IsNaN(volume) then 0 else volume;
#def obv = TotalSum(Sign(close - close[1]) * nzVolume);
#def source5  = if isconfirmed then close else close[1];
#def vsource  = if nzVolume then if isconfirmed then obv else obv[1] else na;
#def corr     = Correlation(source5, vsource, 14);
#def volAvgS  = Average(nzVolume, 14);
def volAvgL  = Average(nzVolume, 14 * 5);
def volDev   = (volAvgL + 1.618034 * StDev(volAvgL, 14 * 5)) / volAvgL * 11 / 100;
def volRel   = nzVolume / volAvgL;
#def momentum = (vsource - vsource[14]) / 14;
#def momOsc   = Inertia(momentum / volAvgS * 1.618034, 5);

#// =======  RedK Dual VADER with Energy Bars [VADER-DEB]
# stoch(source, high, low, length) =>
script stoch {
    input src = close;
    input h = high;
    input l = low;
    input len = 14;
    def hh = Highest(h, len);
    def ll = Lowest(l, len);
    def stoch = 100 * (src - ll) / (hh - ll);
    plot return = stoch;
}
script f_derma {
    input _data = close;
    input _len = 14;
    input MAOption = "SMA";
    def value =
      if MAOption == "SMA" then Average(_data, _len)  else
      if MAOption == "EMA" then ExpAverage(_data, _len) else WMA(_data, _len);
    plot out = value;
}

def v5 = if IsNaN(volume) then 1 else volume;
def stoch = stoch(v5, v5, v5, LookbackForRelative) / 100;
def vola    =
  if VodkaShotCalcOptions == VodkaShotCalcOptions."None" or IsNaN(volume) then 1 else
  if VodkaShotCalcOptions == VodkaShotCalcOptions."Relative" then stoch else v5;
def R       = (Highest(high, 2) - Lowest(low, 2)) / 2;
def sr      = (close - close[1]) / R;
def rsr     = Max(Min(sr, 1), -1);
def rsrVola = (rsr * vola);
def c       = if IsNaN(rsrVola) then c[1] else rsrVola;
def c_plus  =  Max(c, 0);
def c_minus = -Min(c, 0);

#def avg_vola    = f_derma(vola, rlength, MA_Type5);
def dem         = f_derma(c_plus, rlength, MA_Type5);
def sup         = f_derma(c_minus, rlength, MA_Type5);
def adp         = 100 * WMA(dem, DER_avg);
def asp         = 100 * WMA(sup, DER_avg);
#def anp         = adp - asp;
#def anp_s       = WMA(anp, rsmooth);

#def s_adp       = 100 * WMA(dem, senti);
#def s_asp       = 100 * WMA(sup, senti);
#def V_senti     = WMA(s_adp - s_asp, rsmooth);

#def up5      = anp_s >= 0;
#def s_up    = V_senti >= 0;

#def sflag_up = AbsValue(V_senti) >= AbsValue(V_senti[1]);

def bo = if IsNaN(asp) then bo[1] else asp;
def bc = if IsNaN(adp) then bc[1] else adp;
#def bh = Max(bo, bc);
#def bl = Min(bo, bc);

def rising = (bc - bc[1]) > 0;

def barcolor = if bc > bo and rising then 1 else
               if bc < bo and !rising then -1 else 0;

#// ====  RedK Slow_Smooth WMA, RSS_WMA v3 ====
#f_LazyLine(_data, _length) =>
script f_LazyLine {
    input _data = close;
    input _length = 14;
    def w = _length / 3;
    def w2;
    def w1;
    def w3;
    def L1;
    def L2;
    def L3;
    if _length > 2 {
        w2 = Round(w, 0);
        w1 = Round((_length - w2) / 2, 0);
        w3 = Floor((_length - w2) / 2);
        L1 = WMA(_data, w1);
        L2 = WMA(L1, w2);
        L3 = WMA(L2, w3);
    } else {
        w2 = 0;
        w1 = 0;
        w3 = 0;
        L1 = 0;
        L2 = 0;
        L3 = _data;
    }
    plot out = L3;
}

def LL = f_LazyLine(close, 21);

#def luptrend    = LL > LL[1];
#def SigMulti    = 1.0;

#def SignalOn = isconfirmed;
#def SwingDn  = luptrend[1] and !luptrend and isconfirmed;
#def SwingUp  = luptrend and !luptrend[1] and isconfirmed;

#def dl = SigMulti / 100 * LL;

def upwards = LL > LL[1] and (barcolor > 0) and up and (open < close and volRel * .145898 > volDev) and !isLong[1];
def downwards = LL < LL[1]  and (barcolor < 0) and (open > close and volRel * .145898 > volDev) and !isShort[1];

def showUp = upwards and !upwards[1] and !upwards[2] and !upwards[3] and !upwards[4];
def showDown = downwards and !downwards[1] and !upwards[2] and !upwards[3] and !upwards[4];

AddChartBubble(ShowVodkaShot and showUp, low, "V", Color.GREEN, no);
AddChartBubble(ShowVodkaShot and showDown, high, "V", Color.RED);

if showUp {
    isLong = yes;
    isShort = no;
} else
if showDown {
    isLong = no;
    isShort = yes;
} else {
    isLong = isLong[1];
    isShort = isShort[1];
}


#-- END of COE
@samer800 Thanks for awesome work!
 
would you be so kind to explain the method or post links to where it is explained ?
I look for V symbol (referred to as Vodka shot in his trading), T (for trampoline), Diamond and Shark symbol. If you can help with these, I'd really appreciate it. This strategy easily earns $100 to $300 per day easily making use of both upper and lower charts but we can start conversion initially on these symbols and enhance it further.

Look for TraderOracle YouTube channel
 
Last edited by a moderator:
There is a lot to unpack here. If you use this regularly it would be interesting to hear your long term thoughts on it.
Back testing alone does not necessarily matter as all trading could be somewhat discretionary.
 
There is a lot to unpack here. If you use this regularly it would be interesting to hear your long term thoughts on it.
Back testing alone does not necessarily matter as all trading could be somewhat discretionary.
TraderOracle on Youtube uses it extensively and has done and keeps doing (daily) videos while trading the system. He made 10ths of videos for this strategy, if you put the time to watch them, you will get all the answers you need.
Although the best way to find out will be to trade the system on your own with real money and very small size or in playback mode with TV or Ondemand TOS.

TraderOracle also codes his own versions of these indicators and give them away for free for TV users.
He is also quite funny to listen.
https://www.youtube.com/@traderoracle2784
 
TraderOracle on Youtube uses it extensively and has done and keeps doing (daily) videos while trading the system. He made 10ths of videos for this strategy, if you put the time to watch them, you will get all the answers you need.
Although the best way to find out will be to trade the system on your own with real money and very small size or in playback mode with TV or Ondemand TOS.

TraderOracle also codes his own versions of these indicators and give them away for free for TV users.
He is also quite funny to listen.
https://www.youtube.com/@traderoracle2784
his stuff is set up for Tradingview isn't it?
 
@samer800 I took a look at the video with explanation of this (https://www.youtube.com/watch?v=eVWkEFYtpP4) and everything looks great with the exception of the candles being painted the same as in the video. Seems he leaves the candles hallow and then paints certain candles based on volume. Is that possible? Thank you in advance... I just wish I had the skills to code this stuff on my own.

@samer800 I have also opened this script in paper trading while simultaneously in another instance in live trading. Seems that the clouds are not even close to the same in Paper. Any idea what would cause this? I validated all settings are the same in both instances.
 
Last edited by a moderator:
@samer800 I have also opened this script in paper trading while simultaneously in another instance in live trading. Seems that the clouds are not even close to the same in Paper. Any idea what would cause this? I validated all settings are the same in both instances.
OnDemand was created to provide an overview of the potential of ToS.
OnDemand does not reflect live trading.
The thing about paper most don't understand is that it's not tied to live trading. The fills are algorithms not based on what is live.
 
Last edited:
Hello, thanks for the study but noticed there is a second study in the bottom of the screenshot. Just curious to know about that study.
 
What are the buy and sell labels on the original screenshot?
The Tradingview buy / sell are displayed as yellow squares on the ToS version.
The buy is where a candle identified by a long lower shadow and a small real body at the top, is indicating a significant price reversal. When that candle occurs in the lower band of an established upward trend, it is an indication that the next moves will be upwards.
This is what the OP calls: "a needle in the cloud."
Then the opposite is identified as a zone for sell.

Watch the video in the top post for more information.
 
Last edited:
his stuff is set up for Tradingview isn't it?
Yes, it is.
To be fair, yearly Tradingview basic subscription with 5 indicators (which is plenty), is only 149$ and sometime can be bought for less. If someone like those charts they should just go for it. Then those who need fast entries, they can still trade TD Ameritrade/Schwab, by pulling up the active trader next to the Tradingview chart.
 
This is one of the best TV code I've come across which makes good amount every day with futures. If someone like @samer800 can convert it to ToS, it would be super helpful!
https://www.tradingview.com/script/yE35zW1B-TraderOracle-Method/

It is a beginner guide to scalping NASDAQ 100 E-mini futures. Trades are taken based on recognizing volume spikes, squeezes, and candlestick patterns; combined with channel bands to provide support and resistance.

The method starts with a candle identified by a long lower shadow and a small real body at the top, indicating a significant price reversal. When that candle occurs in the lower band of an established upward trend, it is an indication that the next moves will be upwards.
This is what the OP calls: "a needle in the cloud."
R3IfEPM.png


Is there a way to scan for long and short trampolines within 5 bars ? and does the trampoline signal repaint ? thanks in advance
 

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

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