[Request] Convert pinescript to thinkscript

F

Furthur

New member
Hi, I have an indicator from tradingview, I was wondering if it's possible to convert it to think script? Thanks in advance!


Code:
//@version=4
study(title="(JS) Squeeze Pro 2", shorttitle="(JS)SqzPro2", overlay=false)

//----------------------------{ Inputs }----------------------------------------

src                 = input(defval=close, title="Squeeze Input", type=input.source)
int     length      = input(20, title="Length", minval=1)
string  bbmatype    = input(defval='SMA', title='Bollinger Bands Calculation Type', options=['SMA', 'EMA', 'WMA', 'VWMA', 'RMA'])
string  kcmatype    = input(defval='SMA', title='Keltner Channel Calculation Type', options=['SMA', 'EMA', 'WMA', 'VWMA', 'RMA'])
int     color_1     = input(title="Color Format", defval=2, minval=1, maxval=6)
bool    drdiv       = input(defval=false, title="Draw Divergence")
bool    bgoff       = input(defval=false, title="Background Off")
bool    darkm       = input(defval=true, title="Gray Background for Dark Mode")
bool    zerold      = input(defval=false, title="Zero Line Dots")
bool    lowsqzwht   = input(defval=true, title="Low Squeeze White")

//Bollinger Bands Basis Line
smabb       = sma(src, length)
emabb       = ema(src, length)
wmabb       = wma(src, length)
vwmabb      = vwma(src, length)
rmabb       = rma(src, length)
basis       = bbmatype == 'SMA' ? smabb : bbmatype == 'EMA' ? emabb :
   bbmatype == 'WMA' ? wmabb : bbmatype == 'VWMA' ? vwmabb : rmabb

//Keltner Channel Basis Line
smakc       = sma(src, length)
emakc       = ema(src, length)
wmakc       = wma(src, length)
vwmakc      = vwma(src, length)
rmakc       = rma(src, length)
basiskc     = bbmatype == 'SMA' ? smakc : kcmatype == 'EMA' ? emakc :
   kcmatype == 'WMA' ? wmakc : kcmatype == 'VWMA' ? vwmakc : rmakc

// Keltner Channel Low
smakcl      = sma(tr, length)
emakcl      = ema(tr, length)
wmakcl      = wma(tr, length)
vwmakcl     = vwma(tr, length)
rmakcl      = rma(tr, length)
rangemal    = kcmatype == 'SMA' ? smakcl : kcmatype == 'EMA' ? emakcl :
   kcmatype == 'WMA' ? wmakcl : kcmatype == 'VWMA' ? vwmakcl : rmakcl
// Keltner Channel Mid
smakcm      = sma(tr, length)
emakcm      = ema(tr, length)
wmakcm      = wma(tr, length)
vwmakcm     = vwma(tr, length)
rmakcm      = rma(tr, length)
rangemam    = kcmatype == 'SMA' ? smakcm : kcmatype == 'EMA' ? emakcm :
   kcmatype == 'WMA' ? wmakcm : kcmatype == 'VWMA' ? vwmakcm : rmakcm
//Keltner Channel High
smakch      = sma(tr, length)
emakch      = ema(tr, length)
wmakch      = wma(tr, length)
vwmakch     = vwma(tr, length)
rmakch      = rma(tr, length)
rangemah    = kcmatype == 'SMA' ? smakch : kcmatype == 'EMA' ? emakch :
   kcmatype == 'WMA' ? wmakch : kcmatype == 'VWMA' ? vwmakch : rmakch

//{Instead of putting the numbers in the formula, I chose to do it this way so you could set it in actual BB or KC too}

//Bollinger Bands Multiplier
mult        = 2.0
//Keltner Channel Low Multiplier
multlowKC   = 2.0
//Keltner Channel Mid Multiplier
multmidKC   = 1.5
//Keltner Channel High Multiplier
multhighKC  = 1.0

//Bollinger Bands
dev         = mult * stdev(src, length)
upperBB     = basis + dev
lowerBB     = basis - dev
//Keltner Channel Bands Low
upperKCl    = basiskc + rangemal * multlowKC
lowerKCl    = basiskc - rangemal * multlowKC
//Keltner Channel Bands Mid
upperKCm    = basiskc + rangemam * multmidKC
lowerKCm    = basiskc - rangemam * multmidKC
//Keltner Channel Bands High
upperKCh    = basiskc + rangemah * multhighKC
lowerKCh    = basiskc - rangemah * multhighKC

//------------------------{ Squeeze Basics }------------------------------------

//Squeeze Momentum
sz          = linreg(src - avg(avg(highest(high, length), lowest(low, length)), ema(close, length)), length, 0)
//Squeeze Conditions
sc1         = sz >= 0
sc2         = sz < 0
sc3         = sz >= sz[1]
sc4         = sz < sz[1]
sc5         = sz < 1
sc6         = sz > -1
//Squeeze On
lowsqz      = lowerBB > lowerKCl and upperBB < upperKCl
lsf         = lowsqz == false
midsqz      = lowerBB > lowerKCm and upperBB < upperKCm
msf         = midsqz == false
highsqz     = lowerBB > lowerKCh and upperBB < upperKCh
hsf         = highsqz == false

//-----------------------{ Color Components }-----------------------------------

//Color Conditions
clr1        = sc1 and sc3 ? #00eeff :
   sc1 and sc4 ? #000eff : sc2 and sc4 ? #ff0000 : sc2 and sc3 ? #ffe500 : color.gray
clr2        = sc1 and sc3 ? #00bcd4 :
   sc1 and sc4 ? #0d47a1 : sc2 and sc4 ? #ba68c8 : sc2 and sc3 ? #9c27b0 : #673ab7
clr3        = sc1 and sc3 ? #15ff00 : sc1 and sc4 ? #388e3c :
   sc2 and sc4 ? #f44336 : sc2 and sc3 ? #b71c1c : color.gray
clr4        = sc1 and sc3 ? #fff59d :
   sc1 and sc4 ? #ffd600 : sc2 and sc4 ? #ffcc80 : sc2 and sc3 ? #ff9800 : #702700
clr5        = sc1 and sc3 ? #2196f3 :
   sc1 and sc4 ? #0d47a1 : sc2 and sc4 ? #ef9a9a : sc2 and sc3 ? #d32f2f : #ce93d8
clr6        = sc5 and sc1 ? #ef6c00 : sc6 and sc2 ? #ef6c00 : sc1 and sc3 ? #fff176 :
   sc1 and sc4 ? #ffd600 : sc2 and sc4 ? #ef9a9a : sc2 and sc3 ? #d32f2f : #ffb74d
choice      = color_1 == 1 ? clr1 : color_1 == 2 ? clr2 :
   color_1 == 3 ? clr3 : color_1 == 4 ? clr4 : color_1 == 5 ? clr5 : color_1 == 6 ? clr6 : na
//Background Conditions
bg1         = color.gray
bg2         = #673ab7
bg3         = color.gray
bg4         = #ffd600
bg5         = #ce93d8
bg6         = #ffb74d
bgc         = bgoff ? na : color_1 == 1 ? bg1 : color_1 == 2 ? bg2 :
   color_1 == 3 ? bg3 : color_1 == 4 ? bg4 : color_1 == 5 ? bg5 : color_1 == 6 ? bg6 : na
//Background Colors
bgcolor(color=darkm ? bgc : na, editable=false, transp=95, editable=false)
bgcolor(bgoff ? na : choice)
//Squeeze Dot Colors
sqzproc     = highsqz ? #ffe500 : midsqz ? #ff0000 : lowsqz and lowsqzwht ? color.white : lowsqz ? #000000 : na

//-----------------{ Indicator Components and Plots }---------------------------

//Squeeze Dot Plot Above and Below
sqzpro      = zerold ? na : highsqz ? highsqz : midsqz ? midsqz : lowsqz ? lowsqz : na
plotshape(sqzpro, title="Squeeze Dots Top", style=shape.circle, location=location.top, color=sqzproc)
plotshape(sqzpro, title="Squeeze Dots Bottom", style=shape.circle, location=location.bottom, color=sqzproc)

//Squeeze Dot Plot Zero Line
nozero      = lowsqzwht == false
sqzproz     = highsqz ? 0 : midsqz ? 0 : lowsqz ? 0 : na
plot(zerold ? sqzproz : na, title="Zero Line Squeeze", color=sqzproc, linewidth=5,style=plot.style_circles,transp=0)
plot(nozero ? 0 : na, title="Zero Line Squeeze", color=color.white, linewidth=1,style=plot.style_line,transp=0)

//Squeeze Plot
plot(sz, title="Squeeze Momentum", color=choice, style=plot.style_columns, linewidth=1)

//Divergence Formula {Compliments of Ricardo Santos}
ftf(_src) =>
    _src[4] < _src[2] and _src[3] < _src[2] and _src[2] > _src[1] and
       _src[2] > _src[0]
fbf(_src) =>
    _src[4] > _src[2] and _src[3] > _src[2] and _src[2] < _src[1] and
       _src[2] < _src[0]
ffract(_src) =>
    fbf__1 = fbf(_src)
    ftf(_src) ? 1 : fbf__1 ? -1 : 0
fractaltop  = ffract(sz) > 0 ? sz[2] : na
fractalbot  = ffract(sz) < 0 ? sz[2] : na
high_prev   = valuewhen(fractaltop, sz[2], 1)
high_price  = valuewhen(fractaltop, high[2], 1)
low_prev    = valuewhen(fractalbot, sz[2], 1)
low_price   = valuewhen(fractalbot, low[2], 1)
regbeardiv  = fractaltop and high[2] > high_price and sz[2] < high_prev
hidbeardiv  = fractaltop and high[2] < high_price and sz[2] > high_prev
regbulldiv  = fractalbot and low[2] < low_price and sz[2] > low_prev
hidbulldiv  = fractalbot and low[2] > low_price and sz[2] < low_prev

//Divergence Plot
plot(title='Bearish Fractal', series=drdiv ? fractaltop ? sz[2] : na : na, color=regbeardiv ? choice : na, linewidth=2, offset=-2, editable=false)
plot(title='Bullish Fractal', series=drdiv ? fractalbot ? sz[2] : na : na, color=regbulldiv ? choice : na, linewidth=2, offset=-2, editable=false)
plot(title='Bearish Divergence', series=drdiv ? fractaltop ? sz[2] : na : na, style=plot.style_circles, color=regbeardiv ? choice : na, linewidth=3, offset=-2, editable=false)
plot(title='Bullish Divergence', series=drdiv ? fractalbot ? sz[2] : na : na, style=plot.style_circles, color=regbulldiv ? choice : na, linewidth=3, offset=-2, editable=false)

//------------------------{ Alert Conditions }----------------------------------

//Dot Count Regular
ll6         = barssince(lsf) == 6
ml6         = barssince(msf) == 6
hl6         = barssince(hsf) == 6
//Dot Count Prolonged
ll12        = barssince(lsf) == 12
ml12        = barssince(msf) == 12
hl12        = barssince(hsf) == 12
//End Of Squeeze
eol         = barssince(lowsqz) == 1
eom         = barssince(midsqz) == 1
eoh         = barssince(highsqz) == 1
//Start Of Squeeze
sol         = barssince(lsf) == 1
som         = barssince(msf) == 1
soh         = barssince(hsf) == 1

//-----------------------------{ Alerts }---------------------------------------

//6th Dot Alerts
alertcondition(ll6, title="6th White Dot", message="Early Squeeze - 6th White Dot")
alertcondition(ml6, title="6th Red Dot", message="Squeeze - 6th Red Dot")
alertcondition(hl6, title="6th Yellow Dot", message="Power Squeeze - 6th Yellow Dot")
//12th Dot Alerts
alertcondition(ll12, title="12th White Dot", message="Early Squeeze - 12th White Dot")
alertcondition(ml12, title="12th Red Dot", message="Squeeze - 12th Red Dot")
alertcondition(hl12, title="12th Yellow Dot", message="Power Squeeze - 12th Yellow Dot")
//End of Squeeze Alerts
alertcondition(eol, title="White Dot - End of Squeeze", message="White Dot - End of Early Squeeze")
alertcondition(eom, title="Red Dot - End of Squeeze", message="Yellow Dot - End of Squeeze")
alertcondition(eoh, title="Yellow Dot - End of Squeeze", message="Red Dot - End of Power Squeeze")
//Start of Squeeze Alerts
alertcondition(sol, title="Early Squeeze Started", message="White Dot - Early Squeeze Started")
alertcondition(som, title="Squeeze Started", message="Red Dot - Squeeze Started")
alertcondition(soh, title="Power Squeeze Started", message="Yellow Dot - Power Squeeze Started")
//Zero Line Alerts
alertcondition(sz[1] < 0 and sz > 0, title="Zero Line Cross Bullish", message="Zero Line Cross Bullish")
alertcondition(sz[1] > 0 and sz < 0, title="Zero Line Cross Bearish", message="Zero Line Cross Bearish")
 
F

Furthur

New member
We have plenty of squeeze indicators on our forum, check them out and see if they're similar to the one in your request.
Thanks, however not quite what I was looking for. Full credit to @DeftMove did an awesome job with porting over the script.

Code:
#//@version=4
#study(title="(JS) Squeeze Pro 2", shorttitle="(JS)SqzPro2", overlay=false)

#Version 0.9 - DeftMove
#Updated 22JUL2020 @2116


declare lower;

#//----------------------------{ Inputs }----------------------------------------

#src                 = input(defval=close, title="Squeeze Input", type=input.source)
#int     length      = input(20, title="Length", minval=1)
#string  bbmatype    = input(defval='SMA', title='Bollinger Bands Calculation Type', options=['SMA', 'EMA', 'WMA', 'VWMA', 'RMA'])
#string  kcmatype    = input(defval='SMA', title='Keltner Channel Calculation Type', options=['SMA', 'EMA', 'WMA', 'VWMA', 'RMA'])
#int     color_1     = input(title="Color Format", defval=2, minval=1, maxval=6)
#bool    drdiv       = input(defval=false, title="Draw Divergence")
#bool    bgoff       = input(defval=false, title="Background Off")
#bool    darkm       = input(defval=true, title="Gray Background for Dark Mode")
#bool    zerold      = input(defval=false, title="Zero Line Dots")
#bool    lowsqzwht   = input(defval=true, title="Low Squeeze White")

input src = close; #hint src:Squeeze Input
input length = 20; #hint length:Length
Assert(length >= 1, "Minimum Length Value is 1");
input bbmatype = {default SMA, EMA, WMA, VWMA, RMA};
input kcmatype = {default SMA, EMA, WMA, VWMA, RMA};
input color_1 = 2;
Assert(6 <= color_1 <= 1, "color_1 must be between 1 and 6");
input drdiv = no; #hint drdiv: Draw Divergence
input bgoff = no; #hint bgoff: Background Off
input darkm = yes;#hint darkm: Gray Background for Dark Mode
input zerold = no;#hint zerold: Zero Line Dots
input lowsqzwht = yes; #hint lowsqzwht: Low Squeeze White

#//Bollinger Bands Basis Line
#smabb       = sma(src, length)
#emabb       = ema(src, length)
#wmabb       = wma(src, length)
#vwmabb      = vwma(src, length)
#rmabb       = rma(src, length)
#basis       = bbmatype == 'SMA' ? smabb : bbmatype == 'EMA' ? emabb :
#   bbmatype == 'WMA' ? wmabb : bbmatype == 'VWMA' ? vwmabb : rmabb

Script VWMA {
    input source = close;
    def vol = volume;
    input length = 20;
    plot VWMA = Sum(vol * source, length) / Sum(vol, length);
}

#MovingAverage ( int averageType, IDataHolder data, int length);   
def smabb = MovingAverage(AverageType.SIMPLE, src, length);
def emabb = MovingAverage(AverageType.EXPONENTIAL, src, length);
def wmabb = MovingAverage(AverageType.WEIGHTED, src, length);
def vwmabb = VWMA(src,length);
def rmabb = MovingAverage(AverageType.WILDERS, src, length);## Not sure if RMA is Wilders moving average
def basis;
switch (bbmatype) {
case SMA:
    basis = smabb;
case EMA:
    basis = emabb;
case WMA:
    basis = wmabb;
case VWMA:
    basis = vwmabb;
case RMA:
    basis = rmabb;
}


#//Keltner Channel Basis Line
#smakc       = sma(src, length)
#emakc       = ema(src, length)
#wmakc       = wma(src, length)
#vwmakc      = vwma(src, length)
#rmakc       = rma(src, length)
#basiskc     = bbmatype == 'SMA' ? smakc : kcmatype == 'EMA' ? emakc :
#   kcmatype == 'WMA' ? wmakc : kcmatype == 'VWMA' ? vwmakc : rmakc

def smakc = MovingAverage(AverageType.SIMPLE, src, length);
def emakc = MovingAverage(AverageType.EXPONENTIAL, src, length);
def wmakc = MovingAverage(AverageType.WEIGHTED, src, length);
def vwmakc = VWMA(src,length);
def rmakc = MovingAverage(AverageType.WILDERS, src, length);## Not sure if RMA is Wilders moving average
def basiskc;
switch (bbmatype) {
case SMA:
    basiskc = smakc;
case EMA:
    basiskc = emakc;
case WMA:
    basiskc = wmakc;
case VWMA:
    basiskc = vwmakc;
case RMA:
    basiskc = rmakc;
}

def tr = TrueRange(high, close, low);
#// Keltner Channel Low
#smakcl      = sma(tr, length)
#emakcl      = ema(tr, length)
#wmakcl      = wma(tr, length)
#vwmakcl     = vwma(tr, length)
#rmakcl      = rma(tr, length)
#rangemal    = kcmatype == 'SMA' ? smakcl : kcmatype == 'EMA' ? emakcl :
#   kcmatype == 'WMA' ? wmakcl : kcmatype == 'VWMA' ? vwmakcl : rmakcl

def smakcl = MovingAverage(AverageType.SIMPLE, tr, length);
def emakcl = MovingAverage(AverageType.EXPONENTIAL, tr, length);
def wmakcl = MovingAverage(AverageType.WEIGHTED, tr, length);
def vwmakcl = VWMA(tr,length);
def rmakcl = MovingAverage(AverageType.WILDERS, tr, length);## Not sure if RMA is Wilders moving average
def rangemal;
switch (kcmatype) {
case SMA:
    rangemal = smakcl;
case EMA:
    rangemal = emakcl;
case WMA:
    rangemal = wmakcl;
case VWMA:
    rangemal = vwmakcl;
case RMA:
    rangemal = rmakcl;
}

#// Keltner Channel Mid
#smakcm      = sma(tr, length)
#emakcm      = ema(tr, length)
#wmakcm      = wma(tr, length)
#vwmakcm     = vwma(tr, length)
#rmakcm      = rma(tr, length)
#rangemam    = kcmatype == 'SMA' ? smakcm : kcmatype == 'EMA' ? emakcm :
#   kcmatype == 'WMA' ? wmakcm : kcmatype == 'VWMA' ? vwmakcm : rmakcm
def smakcm = MovingAverage(AverageType.SIMPLE, tr, length);
def emakcm = MovingAverage(AverageType.EXPONENTIAL, tr, length);
def wmakcm = MovingAverage(AverageType.WEIGHTED, tr, length);
def vwmakcm = VWMA(tr,length);
def rmakcm = MovingAverage(AverageType.WILDERS, tr, length);## Not sure if RMA is Wilders moving average
def rangemam;
switch (kcmatype) {
case SMA:
    rangemam = smakcm;
case EMA:
    rangemam = emakcm;
case WMA:
    rangemam = wmakcm;
case VWMA:
    rangemam = vwmakcm;
case RMA:
    rangemam = rmakcm;
}


#//Keltner Channel High
#smakch      = sma(tr, length)
#emakch      = ema(tr, length)
#wmakch      = wma(tr, length)
#vwmakch     = vwma(tr, length)
#rmakch      = rma(tr, length)
#rangemah    = kcmatype == 'SMA' ? smakch : kcmatype == 'EMA' ? emakch :
#   kcmatype == 'WMA' ? wmakch : kcmatype == 'VWMA' ? vwmakch : rmakch
def smakch = MovingAverage(AverageType.SIMPLE, tr, length);
def emakch = MovingAverage(AverageType.EXPONENTIAL, tr, length);
def wmakch = MovingAverage(AverageType.WEIGHTED, tr, length);
def vwmakch = VWMA(tr,length);
def rmakch = MovingAverage(AverageType.WILDERS, tr, length);## Not sure if RMA is Wilders moving average
def rangemah;
switch (kcmatype) {
case SMA:
    rangemah = smakch;
case EMA:
    rangemah = emakch;
case WMA:
    rangemah = wmakch;
case VWMA:
    rangemah = vwmakch;
case RMA:
    rangemah = rmakch;
}

#//{Instead of putting the numbers in the formula, I chose to do it this way so you could set it in actual BB or KC too}

#//Bollinger Bands Multiplier
#mult        = 2.0
#//Keltner Channel Low Multiplier
#multlowKC   = 2.0
#//Keltner Channel Mid Multiplier
#multmidKC   = 1.5
#//Keltner Channel High Multiplier
#multhighKC  = 1.0

def mult = 2.0;
def multLowKC = 2.0;
def multMidKC = 1.5;
def multhighKC = 1.0;

#//Bollinger Bands
#dev         = mult * stdev(src, length)
#upperBB     = basis + dev
#lowerBB     = basis - dev
#//Keltner Channel Bands Low
#upperKCl    = basiskc + rangemal * multlowKC
#lowerKCl    = basiskc - rangemal * multlowKC
#//Keltner Channel Bands Mid
#upperKCm    = basiskc + rangemam * multmidKC
#lowerKCm    = basiskc - rangemam * multmidKC
#//Keltner Channel Bands High
#upperKCh    = basiskc + rangemah * multhighKC
#lowerKCh    = basiskc - rangemah * multhighKC

def dev = mult * StDev(src, length);
def upperBB = basis + dev;
def lowerBB = basis - dev;
#//Keltner Channel Bands Low
def upperKCl    = basiskc + rangemal * multlowKC;
def lowerKCl    = basiskc - rangemal * multlowKC;
#//Keltner Channel Bands Mid
def upperKCm    = basiskc + rangemam * multmidKC;
def lowerKCm    = basiskc - rangemam * multmidKC;
#//Keltner Channel Bands High
def upperKCh    = basiskc + rangemah * multhighKC;
def lowerKCh    = basiskc - rangemah * multhighKC;



#//------------------------{ Squeeze Basics }------------------------------------

#//Squeeze Momentum
#sz          = linreg(src - avg(avg(highest(high, length), lowest(low, length)), ema(close, length)), length, 0)
#//Squeeze Conditions
#sc1         = sz >= 0
#sc2         = sz < 0
#sc3         = sz >= sz[1]
#sc4         = sz < sz[1]
#sc5         = sz < 1
#sc6         = sz > -1
#//Squeeze On
#lowsqz      = lowerBB > lowerKCl and upperBB < upperKCl
#lsf         = lowsqz == false
#midsqz      = lowerBB > lowerKCm and upperBB < upperKCm
#msf         = midsqz == false
#highsqz     = lowerBB > lowerKCh and upperBB < upperKCh
#hsf         = highsqz == false

def sz          = Inertia(src -((highest(high, length)+ lowest(low, length))/2 + MovingAverage(averageType.EXPONENTIAL,close, length))/2, length);
#//Squeeze Conditions
def sc1         = sz >= 0;
def sc2         = sz < 0;
def sc3         = sz >= sz[1];
def sc4         = sz < sz[1];
def sc5         = sz < 1;
def sc6         = sz > -1;
#//Squeeze On
def lowsqz      = lowerBB > lowerKCl and upperBB < upperKCl;
def lsf         = lowsqz == no;
def midsqz      = lowerBB > lowerKCm and upperBB < upperKCm;
def msf         = midsqz == no;
def highsqz     = lowerBB > lowerKCh and upperBB < upperKCh;
def hsf         = highsqz == no;













#//-----------------------{ Color Components }-----------------------------------

#//Color Conditions
#clr1        = sc1 and sc3 ? #00eeff :
#   sc1 and sc4 ? #000eff : sc2 and sc4 ? #ff0000 : sc2 and sc3 ? #ffe500 : color.gray
#clr2        = sc1 and sc3 ? #00bcd4 :
#   sc1 and sc4 ? #0d47a1 : sc2 and sc4 ? #ba68c8 : sc2 and sc3 ? #9c27b0 : #673ab7
#clr3        = sc1 and sc3 ? #15ff00 : sc1 and sc4 ? #388e3c :
#   sc2 and sc4 ? #f44336 : sc2 and sc3 ? #b71c1c : color.gray
#clr4        = sc1 and sc3 ? #fff59d :
#   sc1 and sc4 ? #ffd600 : sc2 and sc4 ? #ffcc80 : sc2 and sc3 ? #ff9800 : #702700
#clr5        = sc1 and sc3 ? #2196f3 :
#   sc1 and sc4 ? #0d47a1 : sc2 and sc4 ? #ef9a9a : sc2 and sc3 ? #d32f2f : #ce93d8
#clr6        = sc5 and sc1 ? #ef6c00 : sc6 and sc2 ? #ef6c00 : sc1 and sc3 ? #fff176 :
#   sc1 and sc4 ? #ffd600 : sc2 and sc4 ? #ef9a9a : sc2 and sc3 ? #d32f2f : #ffb74d
#CreateColor
#def clr1        = if sc1 and sc3 then CreateColor(0,238,255)#00eeff 
#             else if sc1 and sc4 then CreateColor(0,14,255)#000eff 
#             else if sc2 and sc4 then CreateColor(255,0,0)#ff0000 
#             else if sc2 and sc3 then CreateColor(255,229,0)#ffe500 
#                             else color.gray;
#def clr2        = if sc1 and sc3 then CreateColor(0,188,212)#00bcd4 
#             else if sc1 and sc4 then CreateColor(13,71,161)#0d47a1 
#             else if sc2 and sc4 then CreateColor(186,104,200)#ba68c8 
#             else if sc2 and sc3 then CreateColor(156,39,176)#9c27b0 
#                             else CreateColor(103,58,183);#673ab7
#def clr3        = if sc1 and sc3 then CreateColor(21,255,0)#15ff00 
#             else if sc1 and sc4 then CreateColor(56,142,60)#388e3c 
#             else if sc2 and sc4 then CreateColor(244,67,54)#f44336 
#             else if sc2 and sc3 then CreateColor(183,28,28)#b71c1c 
#                              else color.gray;
#def clr4        = if sc1 and sc3 then CreateColor(255,245,157)#fff59d 
#             else if sc1 and sc4 then CreateColor(255,214,0)#ffd600 
#             else if sc2 and sc4 then CreateColor(255,204,128)#ffcc80 
#             else if sc2 and sc3 then CreateColor(255,152,0)#ff9800 
#                              else CreateColor(112,39,0);#702700
#def clr5        = if sc1 and sc3 then CreateColor(33,150,243)#2196f3 
#             else if sc1 and sc4 then CreateColor(13,71,161)#0d47a1 
#             else if sc2 and sc4 then CreateColor(239,154,154)#ef9a9a 
#             else if sc2 and sc3 then CreateColor(211,47,47)#d32f2f
#                              else CreateColor(206,147,216);#ce93d8;
#def clr6        = if sc5 and sc1 then CreateColor(239,108,0)#ef6c00 
#             else if sc6 and sc2 then CreateColor(239,108,0)#ef6c00 
#             else if sc1 and sc3 then CreateColor(255,241,118)#fff176 
#             else if sc1 and sc4 then CreateColor(255,214,0)#ffd600 
#             else if sc2 and sc4 then CreateColor(239,154,154)#ef9a9a 
#             else if sc2 and sc3 then CreateColor(211,47,47)#d32f2f 
#                              else CreateColor(255,183,77);#ffb74d



#choice      = color_1 == 1 ? clr1 : color_1 == 2 ? clr2 :
#   color_1 == 3 ? clr3 : color_1 == 4 ? clr4 : color_1 == 5 ? clr5 : color_1 == 6 ? clr6 : na






#//Background Conditions
#bg1         = color.gray
#bg2         = #673ab7
#bg3         = color.gray
#bg4         = #ffd600
#bg5         = #ce93d8
#bg6         = #ffb74d
#bgc         = bgoff ? na : color_1 == 1 ? bg1 : color_1 == 2 ? bg2 :
#   color_1 == 3 ? bg3 : color_1 == 4 ? bg4 : color_1 == 5 ? bg5 : color_1 == 6 ? bg6 : na
#//Background Colors
#bgcolor(color=darkm ? bgc : na, editable=false, transp=95, editable=false)
#bgcolor(bgoff ? na : choice)
#//Squeeze Dot Colors
#sqzproc     = highsqz ? #ffe500 : midsqz ? #ff0000 : lowsqz and lowsqzwht ? color.white : lowsqz ? #000000 : na


#//-----------------{ Indicator Components and Plots }---------------------------

#//Squeeze Dot Plot Above and Below
#sqzpro      = zerold ? na : highsqz ? highsqz : midsqz ? midsqz : lowsqz ? lowsqz : na
#plotshape(sqzpro, title="Squeeze Dots Top", style=shape.circle, location=location.top, color=sqzproc)
#plotshape(sqzpro, title="Squeeze Dots Bottom", style=shape.circle, location=location.bottom, color=sqzproc)
def na = double.NaN;
#defineGlobalColor("sqzProc", if highsqz then createColor(255,229,0) else if midsqz then createColor(255,0,0) else if lowsqz and lowsqzwht then color.WHITE else if lowsqz then color.BLACK else Color.GRAY);
#defineGlobalColor choice = if color_1 == 1 then  if sc1 and sc3 then CreateColor(0,238,255)#00eeff 
#             else if sc1 and sc4 then CreateColor(0,14,255)#000eff 
#             else if sc2 and sc4 then CreateColor(255,0,0)#ff0000 
#             else if sc2 and sc3 then CreateColor(255,229,0)#ffe500 
#                             else color.gray
#                             else if color_1 == 2 then if sc1 and sc3 then CreateColor(0,188,212)#00bcd4 
#             else if sc1 and sc4 then CreateColor(13,71,161)#0d47a1 
#             else if sc2 and sc4 then CreateColor(186,104,200)#ba68c8 
#             else if sc2 and sc3 then CreateColor(156,39,176)#9c27b0 
#                             else CreateColor(103,58,183)#673ab7
#                             else if color_1 == 3 then if sc1 and sc3 then CreateColor(21,255,0)#15ff00 
#             else if sc1 and sc4 then CreateColor(56,142,60)#388e3c 
#             else if sc2 and sc4 then CreateColor(244,67,54)#f44336 
#             else if sc2 and sc3 then CreateColor(183,28,28)#b71c1c 
#                              else color.gray 
#                             else if color_1 == 4 then if sc1 and sc3 then CreateColor(255,245,157)#fff59d 
#             else if sc1 and sc4 then CreateColor(255,214,0)#ffd600 
#             else if sc2 and sc4 then CreateColor(255,204,128)#ffcc80 
#             else if sc2 and sc3 then CreateColor(255,152,0)#ff9800 
#                              else CreateColor(112,39,0)#702700 
#                             else if color_1 == 5 then if sc1 and sc3 then CreateColor(33,150,243)#2196f3 
#             else if sc1 and sc4 then CreateColor(13,71,161)#0d47a1 
#             else if sc2 and sc4 then CreateColor(239,154,154)#ef9a9a 
#             else if sc2 and sc3 then CreateColor(211,47,47)#d32f2f
#                              else CreateColor(206,147,216)#ce93d8; 
#                             else if color_1 == 6 then if sc5 and sc1 then CreateColor(239,108,0)#ef6c00 
#             else if sc6 and sc2 then CreateColor(239,108,0)#ef6c00 
#             else if sc1 and sc3 then CreateColor(255,241,118)#fff176 
#             else if sc1 and sc4 then CreateColor(255,214,0)#ffd600 
#             else if sc2 and sc4 then CreateColor(239,154,154)#ef9a9a 
#             else if sc2 and sc3 then CreateColor(211,47,47)#d32f2f 
#                              else CreateColor(255,183,77)#ffb74d
#                             else color.BLACK;


def sqzpro = if zerold then no else if highsqz then highsqz else if midsqz then midsqz else if lowsqz then lowsqz else no;
plot sqzproTop = if sqzpro then highestall(sz) else na;
plot sqzproBot = if sqzpro then lowestall(sz) else na;
sqzproTop .setPaintingStrategy(PaintingStrategy.POINTS);
sqzproTop .setDefaultColor(Color.White);
sqzproTop .AssignValueColor( if highsqz then createColor(255,229,0) else if midsqz then createColor(255,0,0) else if lowsqz and lowsqzwht then color.WHITE else if lowsqz then color.BLACK else Color.GRAY);
#sqzproTop .

sqzproBot .setPaintingStrategy(PaintingStrategy.POINTS);
sqzproBot .setDefaultColor(Color.White);
sqzproBot .AssignValueColor( if highsqz then createColor(255,229,0) else if midsqz then createColor(255,0,0) else if lowsqz and lowsqzwht then color.WHITE else if lowsqz then color.BLACK else Color.GRAY);
#sqzproBot .

#//Squeeze Dot Plot Zero Line
#nozero      = lowsqzwht == false
#sqzproz     = highsqz ? 0 : midsqz ? 0 : lowsqz ? 0 : na
#plot(zerold ? sqzproz : na, title="Zero Line Squeeze", color=sqzproc, linewidth=5,style=plot.style_circles,transp=0)
#plot(nozero ? 0 : na, title="Zero Line Squeeze", color=color.white, linewidth=1,style=plot.style_line,transp=0)
def nozero = lowsqzwht == no;
def sqzproz = if highsqz then 0 else if midsqz then 0 else if lowsqz then 0 else na;
plot sqzproZero = if zerold then sqzproz else na;
sqzproZero .setPaintingStrategy(PaintingStrategy.POINTS);
sqzproZero .setDefaultColor(Color.White);
sqzproZero .AssignValueColor( if highsqz then createColor(255,229,0) else if midsqz then createColor(255,0,0) else if lowsqz and lowsqzwht then color.WHITE else if lowsqz then color.BLACK else Color.GRAY);
sqzproZero .setLineWeight(4);

plot sqzproZeroLine = if nozero then 0 else na;
sqzproZeroLine .setPaintingStrategy(PaintingStrategy.LINE);
sqzproZeroLine .setDefaultColor(Color.White);


#//Squeeze Plot
#plot(sz, title="Squeeze Momentum", color=choice, style=plot.style_columns, linewidth=1)
plot szMomentum = sz;
szMomentum .setPaintingStrategy(PaintingStrategy.HISTOGRAM);
szMomentum .setDefaultColor(Color.White);
szMomentum .AssignValueColor( if color_1 == 1 then  if sc1 and sc3 then CreateColor(0,238,255)#00eeff 
             else if sc1 and sc4 then CreateColor(0,14,255)#000eff 
             else if sc2 and sc4 then CreateColor(255,0,0)#ff0000 
             else if sc2 and sc3 then CreateColor(255,229,0)#ffe500 
                             else color.gray
                             else if color_1 == 2 then if sc1 and sc3 then CreateColor(0,188,212)#00bcd4 
             else if sc1 and sc4 then CreateColor(13,71,161)#0d47a1 
             else if sc2 and sc4 then CreateColor(186,104,200)#ba68c8 
             else if sc2 and sc3 then CreateColor(156,39,176)#9c27b0 
                             else CreateColor(103,58,183)#673ab7
                             else if color_1 == 3 then if sc1 and sc3 then CreateColor(21,255,0)#15ff00 
             else if sc1 and sc4 then CreateColor(56,142,60)#388e3c 
             else if sc2 and sc4 then CreateColor(244,67,54)#f44336 
             else if sc2 and sc3 then CreateColor(183,28,28)#b71c1c 
                              else color.gray 
                             else if color_1 == 4 then if sc1 and sc3 then CreateColor(255,245,157)#fff59d 
             else if sc1 and sc4 then CreateColor(255,214,0)#ffd600 
             else if sc2 and sc4 then CreateColor(255,204,128)#ffcc80 
             else if sc2 and sc3 then CreateColor(255,152,0)#ff9800 
                              else CreateColor(112,39,0)#702700 
                             else if color_1 == 5 then if sc1 and sc3 then CreateColor(33,150,243)#2196f3 
             else if sc1 and sc4 then CreateColor(13,71,161)#0d47a1 
             else if sc2 and sc4 then CreateColor(239,154,154)#ef9a9a 
             else if sc2 and sc3 then CreateColor(211,47,47)#d32f2f
                              else CreateColor(206,147,216)#ce93d8; 
                             else if color_1 == 6 then if sc5 and sc1 then CreateColor(239,108,0)#ef6c00 
             else if sc6 and sc2 then CreateColor(239,108,0)#ef6c00 
             else if sc1 and sc3 then CreateColor(255,241,118)#fff176 
             else if sc1 and sc4 then CreateColor(255,214,0)#ffd600 
             else if sc2 and sc4 then CreateColor(239,154,154)#ef9a9a 
             else if sc2 and sc3 then CreateColor(211,47,47)#d32f2f 
                              else CreateColor(255,183,77)#ffb74d
                             else color.BLACK);

#//Divergence Formula {Compliments of Ricardo Santos}
#ftf(_src) =>
#    _src[4] < _src[2] and _src[3] < _src[2] and _src[2] > _src[1] and
#       _src[2] > _src[0]

#fbf(_src) =>
#    _src[4] > _src[2] and _src[3] > _src[2] and _src[2] < _src[1] and
#       _src[2] < _src[0]

#ffract(_src) =>
#    fbf__1 = fbf(_src)
#    ftf(_src) ? 1 : fbf__1 ? -1 : 0

Script ffract {
    input _src = close;
    def fbf =  _src[4] > _src[2] and _src[3] > _src[2] and _src[2] < _src[1] and _src[2] < _src[0];
    def ftf =  _src[4] < _src[2] and _src[3] < _src[2] and _src[2] > _src[1] and _src[2] > _src[0];
    plot ffract = if ftf then 1 else if fbf then -1 else 0;
}

#fractaltop  = ffract(sz) > 0 ? sz[2] : na
#fractalbot  = ffract(sz) < 0 ? sz[2] : na
#high_prev   = valuewhen(fractaltop, sz[2], 1)
#high_price  = valuewhen(fractaltop, high[2], 1)
#low_prev    = valuewhen(fractalbot, sz[2], 1)
#low_price   = valuewhen(fractalbot, low[2], 1)
#regbeardiv  = fractaltop and high[2] > high_price and sz[2] < high_prev
#hidbeardiv  = fractaltop and high[2] < high_price and sz[2] > high_prev
#regbulldiv  = fractalbot and low[2] < low_price and sz[2] > low_prev
#hidbulldiv  = fractalbot and low[2] > low_price and sz[2] < low_prev

def fractaltop  = if ffract(sz) > 0 then sz[2] else na;
def fractalbot  = if ffract(sz) < 0 then sz[2] else na;
def high_prev   = if isNaN(fractaltop) then high_prev[1] else sz[2];# valuewhen(fractaltop, sz[2], 1)
def high_price  = if isNaN(fractaltop) then high_price[1] else high[2];# valuewhen(fractaltop, high[2], 1)
def low_prev    = if isNaN(fractalbot) then low_prev[1] else sz[2];#valuewhen(fractalbot, sz[2], 1)
def low_price   = if isNaN(fractalbot) then low_price[1] else low[2];# valuewhen(fractalbot, low[2], 1)
def regbeardiv  = fractaltop and high[2] > high_price and sz[2] < high_prev;
def hidbeardiv  = fractaltop and high[2] < high_price and sz[2] > high_prev;
def regbulldiv  = fractalbot and low[2] < low_price and sz[2] > low_prev;
def hidbulldiv  = fractalbot and low[2] > low_price and sz[2] < low_prev;

#//Divergence Plot
#plot(title='Bearish Fractal', series=drdiv ? fractaltop ? sz[2] : na : na, color=regbeardiv ? choice : na, linewidth=2, offset=-2, editable=false)
#plot(title='Bullish Fractal', series=drdiv ? fractalbot ? sz[2] : na : na, color=regbulldiv ? choice : na, linewidth=2, offset=-2, editable=false)
#plot(title='Bearish Divergence', series=drdiv ? fractaltop ? sz[2] : na : na, style=plot.style_circles, color=regbeardiv ? choice : na, linewidth=3, offset=-2, editable=false)
#plot(title='Bullish Divergence', series=drdiv ? fractalbot ? sz[2] : na : na, style=plot.style_circles, color=regbulldiv ? choice : na, linewidth=3, offset=-2, editable=false)

def BearishFractal = if drdiv then if fractaltop then sz[2] else na else na;
def BullishFractal = if drdiv then if fractalbot then sz[2] else na else na;
def BearishDiverge = if drdiv then if fractaltop then sz[2] else na else na;
def BullishDiverge = if drdiv then if fractalbot then sz[2] else na else na;

plot pBearishFractal = BearishFractal[-2];#offset -2
plot pBullishFractal = BullishFractal[-2];#offset -2
plot pBearishDiverge = BearishDiverge[-2];#offset -2
plot pBullishDiverge = BullishDiverge[-2];#offset -2
pBearishFractal .setDefaultColor(Color.DARK_RED);
pBullishFractal .setDefaultColor(Color.DARK_GREEN);
pBearishDiverge .setDefaultColor(Color.DARK_RED);
pBullishDiverge .setDefaultColor(Color.DARK_GREEN);

pBearishFractal .setPaintingStrategy(PaintingStrategy.POINTS);
pBullishFractal .setPaintingStrategy(PaintingStrategy.POINTS);
pBearishDiverge .setPaintingStrategy(PaintingStrategy.POINTS);
pBullishDiverge .setPaintingStrategy(PaintingStrategy.POINTS);

pBearishFractal .setLineWeight(3);
pBullishFractal .setLineWeight(3);
pBearishDiverge .setLineWeight(3);
pBullishDiverge .setLineWeight(3);

pBearishFractal .AssignValueColor(if color_1 == 1 then  if sc1 and sc3 then CreateColor(0,238,255)#00eeff 
             else if sc1 and sc4 then CreateColor(0,14,255)#000eff 
             else if sc2 and sc4 then CreateColor(255,0,0)#ff0000 
             else if sc2 and sc3 then CreateColor(255,229,0)#ffe500 
                             else color.gray
                             else if color_1 == 2 then if sc1 and sc3 then CreateColor(0,188,212)#00bcd4 
             else if sc1 and sc4 then CreateColor(13,71,161)#0d47a1 
             else if sc2 and sc4 then CreateColor(186,104,200)#ba68c8 
             else if sc2 and sc3 then CreateColor(156,39,176)#9c27b0 
                             else CreateColor(103,58,183)#673ab7
                             else if color_1 == 3 then if sc1 and sc3 then CreateColor(21,255,0)#15ff00 
             else if sc1 and sc4 then CreateColor(56,142,60)#388e3c 
             else if sc2 and sc4 then CreateColor(244,67,54)#f44336 
             else if sc2 and sc3 then CreateColor(183,28,28)#b71c1c 
                              else color.gray 
                             else if color_1 == 4 then if sc1 and sc3 then CreateColor(255,245,157)#fff59d 
             else if sc1 and sc4 then CreateColor(255,214,0)#ffd600 
             else if sc2 and sc4 then CreateColor(255,204,128)#ffcc80 
             else if sc2 and sc3 then CreateColor(255,152,0)#ff9800 
                              else CreateColor(112,39,0)#702700 
                             else if color_1 == 5 then if sc1 and sc3 then CreateColor(33,150,243)#2196f3 
             else if sc1 and sc4 then CreateColor(13,71,161)#0d47a1 
             else if sc2 and sc4 then CreateColor(239,154,154)#ef9a9a 
             else if sc2 and sc3 then CreateColor(211,47,47)#d32f2f
                              else CreateColor(206,147,216)#ce93d8; 
                             else if color_1 == 6 then if sc5 and sc1 then CreateColor(239,108,0)#ef6c00 
             else if sc6 and sc2 then CreateColor(239,108,0)#ef6c00 
             else if sc1 and sc3 then CreateColor(255,241,118)#fff176 
             else if sc1 and sc4 then CreateColor(255,214,0)#ffd600 
             else if sc2 and sc4 then CreateColor(239,154,154)#ef9a9a 
             else if sc2 and sc3 then CreateColor(211,47,47)#d32f2f 
                              else CreateColor(255,183,77)#ffb74d
                             else color.BLACK);
pBullishFractal .AssignValueColor(if color_1 == 1 then  if sc1 and sc3 then CreateColor(0,238,255)#00eeff 
             else if sc1 and sc4 then CreateColor(0,14,255)#000eff 
             else if sc2 and sc4 then CreateColor(255,0,0)#ff0000 
             else if sc2 and sc3 then CreateColor(255,229,0)#ffe500 
                             else color.gray
                             else if color_1 == 2 then if sc1 and sc3 then CreateColor(0,188,212)#00bcd4 
             else if sc1 and sc4 then CreateColor(13,71,161)#0d47a1 
             else if sc2 and sc4 then CreateColor(186,104,200)#ba68c8 
             else if sc2 and sc3 then CreateColor(156,39,176)#9c27b0 
                             else CreateColor(103,58,183)#673ab7
                             else if color_1 == 3 then if sc1 and sc3 then CreateColor(21,255,0)#15ff00 
             else if sc1 and sc4 then CreateColor(56,142,60)#388e3c 
             else if sc2 and sc4 then CreateColor(244,67,54)#f44336 
             else if sc2 and sc3 then CreateColor(183,28,28)#b71c1c 
                              else color.gray 
                             else if color_1 == 4 then if sc1 and sc3 then CreateColor(255,245,157)#fff59d 
             else if sc1 and sc4 then CreateColor(255,214,0)#ffd600 
             else if sc2 and sc4 then CreateColor(255,204,128)#ffcc80 
             else if sc2 and sc3 then CreateColor(255,152,0)#ff9800 
                              else CreateColor(112,39,0)#702700 
                             else if color_1 == 5 then if sc1 and sc3 then CreateColor(33,150,243)#2196f3 
             else if sc1 and sc4 then CreateColor(13,71,161)#0d47a1 
             else if sc2 and sc4 then CreateColor(239,154,154)#ef9a9a 
             else if sc2 and sc3 then CreateColor(211,47,47)#d32f2f
                              else CreateColor(206,147,216)#ce93d8; 
                             else if color_1 == 6 then if sc5 and sc1 then CreateColor(239,108,0)#ef6c00 
             else if sc6 and sc2 then CreateColor(239,108,0)#ef6c00 
             else if sc1 and sc3 then CreateColor(255,241,118)#fff176 
             else if sc1 and sc4 then CreateColor(255,214,0)#ffd600 
             else if sc2 and sc4 then CreateColor(239,154,154)#ef9a9a 
             else if sc2 and sc3 then CreateColor(211,47,47)#d32f2f 
                              else CreateColor(255,183,77)#ffb74d
                             else color.BLACK);
pBearishDiverge .AssignValueColor(if color_1 == 1 then  if sc1 and sc3 then CreateColor(0,238,255)#00eeff 
             else if sc1 and sc4 then CreateColor(0,14,255)#000eff 
             else if sc2 and sc4 then CreateColor(255,0,0)#ff0000 
             else if sc2 and sc3 then CreateColor(255,229,0)#ffe500 
                             else color.gray
                             else if color_1 == 2 then if sc1 and sc3 then CreateColor(0,188,212)#00bcd4 
             else if sc1 and sc4 then CreateColor(13,71,161)#0d47a1 
             else if sc2 and sc4 then CreateColor(186,104,200)#ba68c8 
             else if sc2 and sc3 then CreateColor(156,39,176)#9c27b0 
                             else CreateColor(103,58,183)#673ab7
                             else if color_1 == 3 then if sc1 and sc3 then CreateColor(21,255,0)#15ff00 
             else if sc1 and sc4 then CreateColor(56,142,60)#388e3c 
             else if sc2 and sc4 then CreateColor(244,67,54)#f44336 
             else if sc2 and sc3 then CreateColor(183,28,28)#b71c1c 
                              else color.gray 
                             else if color_1 == 4 then if sc1 and sc3 then CreateColor(255,245,157)#fff59d 
             else if sc1 and sc4 then CreateColor(255,214,0)#ffd600 
             else if sc2 and sc4 then CreateColor(255,204,128)#ffcc80 
             else if sc2 and sc3 then CreateColor(255,152,0)#ff9800 
                              else CreateColor(112,39,0)#702700 
                             else if color_1 == 5 then if sc1 and sc3 then CreateColor(33,150,243)#2196f3 
             else if sc1 and sc4 then CreateColor(13,71,161)#0d47a1 
             else if sc2 and sc4 then CreateColor(239,154,154)#ef9a9a 
             else if sc2 and sc3 then CreateColor(211,47,47)#d32f2f
                              else CreateColor(206,147,216)#ce93d8; 
                             else if color_1 == 6 then if sc5 and sc1 then CreateColor(239,108,0)#ef6c00 
             else if sc6 and sc2 then CreateColor(239,108,0)#ef6c00 
             else if sc1 and sc3 then CreateColor(255,241,118)#fff176 
             else if sc1 and sc4 then CreateColor(255,214,0)#ffd600 
             else if sc2 and sc4 then CreateColor(239,154,154)#ef9a9a 
             else if sc2 and sc3 then CreateColor(211,47,47)#d32f2f 
                              else CreateColor(255,183,77)#ffb74d
                             else color.BLACK);
pBullishDiverge .AssignValueColor(if color_1 == 1 then  if sc1 and sc3 then CreateColor(0,238,255)#00eeff 
             else if sc1 and sc4 then CreateColor(0,14,255)#000eff 
             else if sc2 and sc4 then CreateColor(255,0,0)#ff0000 
             else if sc2 and sc3 then CreateColor(255,229,0)#ffe500 
                             else color.gray
                             else if color_1 == 2 then if sc1 and sc3 then CreateColor(0,188,212)#00bcd4 
             else if sc1 and sc4 then CreateColor(13,71,161)#0d47a1 
             else if sc2 and sc4 then CreateColor(186,104,200)#ba68c8 
             else if sc2 and sc3 then CreateColor(156,39,176)#9c27b0 
                             else CreateColor(103,58,183)#673ab7
                             else if color_1 == 3 then if sc1 and sc3 then CreateColor(21,255,0)#15ff00 
             else if sc1 and sc4 then CreateColor(56,142,60)#388e3c 
             else if sc2 and sc4 then CreateColor(244,67,54)#f44336 
             else if sc2 and sc3 then CreateColor(183,28,28)#b71c1c 
                              else color.gray 
                             else if color_1 == 4 then if sc1 and sc3 then CreateColor(255,245,157)#fff59d 
             else if sc1 and sc4 then CreateColor(255,214,0)#ffd600 
             else if sc2 and sc4 then CreateColor(255,204,128)#ffcc80 
             else if sc2 and sc3 then CreateColor(255,152,0)#ff9800 
                              else CreateColor(112,39,0)#702700 
                             else if color_1 == 5 then if sc1 and sc3 then CreateColor(33,150,243)#2196f3 
             else if sc1 and sc4 then CreateColor(13,71,161)#0d47a1 
             else if sc2 and sc4 then CreateColor(239,154,154)#ef9a9a 
             else if sc2 and sc3 then CreateColor(211,47,47)#d32f2f
                              else CreateColor(206,147,216)#ce93d8; 
                             else if color_1 == 6 then if sc5 and sc1 then CreateColor(239,108,0)#ef6c00 
             else if sc6 and sc2 then CreateColor(239,108,0)#ef6c00 
             else if sc1 and sc3 then CreateColor(255,241,118)#fff176 
             else if sc1 and sc4 then CreateColor(255,214,0)#ffd600 
             else if sc2 and sc4 then CreateColor(239,154,154)#ef9a9a 
             else if sc2 and sc3 then CreateColor(211,47,47)#d32f2f 
                              else CreateColor(255,183,77)#ffb74d
                             else color.BLACK);

#//------------------------{ Alert Conditions }----------------------------------

#//Dot Count Regular
#ll6         = barssince(lsf) == 6
#ml6         = barssince(msf) == 6
#hl6         = barssince(hsf) == 6
#//Dot Count Prolonged
#ll12        = barssince(lsf) == 12
#ml12        = barssince(msf) == 12
#hl12        = barssince(hsf) == 12
#//End Of Squeeze
#eol         = barssince(lowsqz) == 1
#eom         = barssince(midsqz) == 1
#eoh         = barssince(highsqz) == 1
#//Start Of Squeeze
#sol         = barssince(lsf) == 1
#som         = barssince(msf) == 1
#soh         = barssince(hsf) == 1

#//-----------------------------{ Alerts }---------------------------------------

#//6th Dot Alerts
#alertcondition(ll6, title="6th White Dot", message="Early Squeeze - 6th White Dot")
#alertcondition(ml6, title="6th Red Dot", message="Squeeze - 6th Red Dot")
#alertcondition(hl6, title="6th Yellow Dot", message="Power Squeeze - 6th Yellow Dot")
#//12th Dot Alerts
#alertcondition(ll12, title="12th White Dot", message="Early Squeeze - 12th White Dot")
#alertcondition(ml12, title="12th Red Dot", message="Squeeze - 12th Red Dot")
#alertcondition(hl12, title="12th Yellow Dot", message="Power Squeeze - 12th Yellow Dot")
#//End of Squeeze Alerts
#alertcondition(eol, title="White Dot - End of Squeeze", message="White Dot - End of Early Squeeze")
#alertcondition(eom, title="Red Dot - End of Squeeze", message="Yellow Dot - End of Squeeze")
#alertcondition(eoh, title="Yellow Dot - End of Squeeze", message="Red Dot - End of Power Squeeze")
#//Start of Squeeze Alerts
#alertcondition(sol, title="Early Squeeze Started", message="White Dot - Early Squeeze Started")
#alertcondition(som, title="Squeeze Started", message="Red Dot - Squeeze Started")
#alertcondition(soh, title="Power Squeeze Started", message="Yellow Dot - Power Squeeze Started")
#//Zero Line Alerts
#alertcondition(sz[1] < 0 and sz > 0, title="Zero Line Cross Bullish", message="Zero Line Cross Bullish")
#alertcondition(sz[1] > 0 and sz < 0, title="Zero Line Cross Bearish", message="Zero Line Cross Bearish")
 
J

jezzer46

Member
@Furthur. Is there a breakdown on what means what on this? Thanks
 

Similar threads

Top