Ichimoku Signal + Candle Pattern For ThinkOrSwim

Can anyone please convert this ?
check out the below. I didn't test it do you do pls.

CSS:
#//@Crypto_level_UP
#study("Ichimoku Signal + Candle Color + Candle Pattern", overlay = true, shorttitle="Ichi + CC + CP")
# converted by Sam4Cok@Samer800    -06/2023
input ema = no;#(false, title="using ema?")
input lenema = 200;#, minval=1, title="EMA period")
input ColorBars = no;#(false, title="Candle Color ? ")
input CustSession     = no;#(defval=false,title= "Custom Time Frame ? ",type=bool)
input SessionTF0    = AggregationPeriod.HOUR;#(title="Custom Time Frame", type=resolution,defval="60")
input CustSession1     = no;#(defval=false,title= "Custom Time Frame not in menu above ? ",type=bool)
input SessionTF1    = AggregationPeriod.FOUR_HOURS;#(type= string, defval="240",title="Custom Time Frame not in menu above")
input TF_Type        = no;#(type= bool, defval=false,title="TimeFrame HIGHER than Daily ?")
input colbgON        = no;#(type= bool, defval=false,title='Highlight background color with sec. indicator ?')
input isHA         = yes;#(true, "Apply HA Candles Indicator on regular candle", bool)
#//--  INPUT ICHIMOKU --------
input ichi = yes;#(true, title="Ichimoku ? ")
input ichi2 = no;#(false, title="Ichimoku adjust and double ?")
input tenkanPeriods = 9;#, minval=1, title="Tenkan-sen Periods")
input kijunPeriods = 26;#, minval=1, title="Kijun-sen Periods")
input SenkouSpanBPeriods = 52;#, minval=1, title="Senkou Span B Periods")
input displacement = 26;#, minval=1, title="Chikou Periods")
input kyanPeriods = 65;#, minval=1, title="Kyan-sen Periods")
input cr1 = yes;#(true, title="Show Crosses up/down Tenkan-Sen and Kinjun-Sen ?")
input cr2 = yes;#(true, title="Show Crosses up/down Chikou Span and Cloud ?")
#//-  INPUT CANDLE PATTERNS ------
input isCandlePatterns = no;#(false, title = "auto Candle Patterns ?")
input DojiSize = 0.03;#, minval=0.01, title="Doji size")

def na = Double.NaN;

def SessionTF     = if CustSession1 then SessionTF1 else SessionTF0;

def RSI_Lenght0    = 26;
def RSI_Lenght1    = 14;
def OverBought_Band    = 69.1;
def OverSold_Band    = 30.9;
def VIP_Upper    = 61.8;
def VIP_Lower    = 38.2;

def res = if CustSession then SessionTF else GetAggregationPeriod();
#def data         = isHA ? heikenashi(tickerid) : tickerid
def Op = open(Period = res);
def hi = high(Period = res);
def lo = low(Period = res);
def cl = close(Period = res);
def haClose = (Op + hi + lo + cl) / 4;
def haOpen = CompoundValue(1, (haOpen[1] + haClose[1]) / 2, (Op + cl) / 2);
def haHigh = Max(Max(hi, haOpen), haClose);
def haLow = Min(Min(lo, haOpen), haClose);

def o = if isHA then haOpen else Op;
def c = if isHA then haClose else cl;
def l = if isHA then haLow else lo;
def h = if isHA then haHigh else hi;
#//--  INPUT ICHIMOKU --------
def tenkanPeriods2 = 26;
def kijunPeriods2 = 65;
def SenkouSpanBPeriods2 = 129;
def displacement2 = 33;

script donchian {
    input len = 26;
    def hh = Highest(high, len);
    def ll = Lowest(low, len);
    def donchian = (hh + ll) / 2;
    plot out = donchian;
}
#//------ EMA --------//
def emaline = ExpAverage(close, lenema);
plot MovAvgLine = if ema then emaline else na;#, title = "ema line", color = purple)
MovAvgLine.SetDefaultColor(Color.VIOLET);
#//----  ICHIMOKU   --------
def Tenkansen = donchian(tenkanPeriods);
def Kijunsen = donchian(kijunPeriods);
def SenkouSpanA = (Tenkansen + Kijunsen) / 2;
def SenkouSpanB = donchian(SenkouSpanBPeriods);
def Kyansen = donchian(kyanPeriods);
def cloud = SenkouSpanA - SenkouSpanB;

def Tenkansen2 = donchian(tenkanPeriods2);
def Kijunsen2 = donchian(kijunPeriods2);
def SenkouSpanA2 = (Tenkansen2 + Kijunsen2) /2;
def SenkouSpanB2 = donchian(SenkouSpanBPeriods2);
def cloud2 = SenkouSpanA2 - SenkouSpanB2;

def crossup = if Tenkansen[1] < Kijunsen[1] and Tenkansen > Kijunsen then 1 else 0;
def crossdown = if Tenkansen[1] > Kijunsen[1] and Tenkansen < Kijunsen then 1 else 0;
def abovecloud = if close > SenkouSpanA[displacement] and close > SenkouSpanB[displacement] then 1 else 0;
def bellowcloud = if close < SenkouSpanA[displacement] and close < SenkouSpanB[displacement] then 1 else 0;
def incloud = if (close > SenkouSpanA[displacement] and close < SenkouSpanB[displacement]) or (close < SenkouSpanA[displacement] and close > SenkouSpanB[displacement]) then 1 else 0;
def cupA = if crossup == 1 and abovecloud == 1 then crossup else 0;
def cupB = if crossup == 1 and incloud == 1 then crossup else 0;
def cupC = if crossup == 1 and bellowcloud == 1 then crossup else 0;
def cdnA = if crossdown == 1 and bellowcloud == 1 then crossdown else 0;
def cdnB = if crossdown == 1 and incloud == 1 then crossdown else 0;
def cdnC = if crossdown == 1 and abovecloud == 1 then crossdown else 0;

def flyupA = if close[1] < SenkouSpanA[displacement * 2 + 1] and close > SenkouSpanA[displacement * 2] then 1 else 0;
def digdownA = if close[1] > SenkouSpanA[displacement * 2 + 1] and close < SenkouSpanA[displacement * 2] then 1 else 0;
def flyupB = if close[1] < SenkouSpanB[displacement * 2 + 1] and close > SenkouSpanB[displacement * 2] then 1 else 0;
def digdownB = if close[1] > SenkouSpanB[displacement * 2 + 1] and close < SenkouSpanB[displacement * 2] then 1 else 0;
def flyA = if cloud[displacement * 2 + 1] > 0 and flyupA == 1 then 1 else 0;
def flyB = if cloud[displacement * 2 + 1] < 0 and flyupB == 1 then 1 else 0;
def digA = if cloud[displacement * 2 + 1] < 0 and digdownA == 1 then 1 else 0;
def digB = if cloud[displacement * 2 + 1] > 0 and digdownB == 1 then 1 else 0;

def preflyupA = if close[1] < SenkouSpanA[displacement + 1] and close > SenkouSpanA[displacement] then 1 else 0;
def predigdownA = if close[1] > SenkouSpanA[displacement + 1] and close < SenkouSpanA[displacement] then 1 else 0;
def preflyupB = if close[1] < SenkouSpanB[displacement + 1] and close > SenkouSpanB[displacement] then 1 else 0;
def predigdownB = if close[1] > SenkouSpanB[displacement + 1] and close < SenkouSpanB[displacement] then 1 else 0;
def preflyA = if cloud[displacement] > 0 and preflyupA == 1 then 1 else 0;
def preflyB = if cloud[displacement] < 0 and preflyupB == 1 then 1 else 0;
def predigA = if cloud[displacement] < 0 and predigdownA == 1 then 1 else 0;
def predigB = if cloud[displacement] > 0 and predigdownB == 1 then 1 else 0;
 
#//-----------  RSI LINE   -----------

def RSI_Lenght = if TF_Type then RSI_Lenght0 else RSI_Lenght1;

def r0     =  rsi(Price=c, Length=RSI_Lenght);
def r1     =  rsi(Price=c, Length=RSI_Lenght0);

def rsi_sma = Average(r0, 500);

def uprsi     = WildersAverage(max((c-c[1]), 0), RSI_Lenght);
def downrsi   = WildersAverage(-min((c-c[1]), 0), RSI_Lenght);
def Myrsi     = if downrsi == 0 then 100 else
                if uprsi == 0 then 0 else 100 - (100 / (1 + uprsi / downrsi));# //coloring method below
 
def src1 = c; def len1 = OverSold_Band;
def src2 = c; def len2 = VIP_Lower;
def src3 = c; def len3 = rsi_sma;
def src4 = c; def len4 = VIP_Upper;
def src5 = c; def len5 = OverBought_Band;

def issuperoversold = Myrsi < len1;
def isoversold      = Myrsi > len1 and Myrsi < len2;
def issold          = Myrsi > len2 and Myrsi < len3;
def isbought        = Myrsi > len3 and Myrsi < len4;
def isoverbought    = Myrsi > len4 and Myrsi < len5;
def issuperoverbought = Myrsi > len5;

#//-------- CANDLE COLOR -------
def col = if (issuperoversold) then -3 else
          if (isoversold) then -2 else
          if (issold) then -1 else
          if (isbought) then 1 else
          if (isoverbought) then 2 else
          if (issuperoverbought) then 3  else 0; #"Bar Colorization'
AssignPriceColor(if !ColorBars then Color.CURRENT else
                 if col == 3 then Color.CYAN else
                 if col == 2 then Color.GREEN else
                 if col == 1 then Color.DARK_GREEN else
                 if col == -1 then Color.DARK_RED else
                 if col == -2 then Color.RED else
                 if col == -3 then Color.MAGENTA else Color.GRAY);
    
#/------- ICHIMOKU LINE, CLOUD AND SIGNAL --------------//
plot Tenkan_Sen = if ichi then Tenkansen else na;                           # "Tenkan-sen"
plot Kijun_Sen = if (ichi or ichi2) then Kijunsen else na;                  # "Kijun-sen"
plot Chikou_Span = if (ichi or ichi2) then close[-displacement] else na;    # "Chikou Span"
plot Kyan_Sen = if (ichi or ichi2) then Kyansen else na;                    # "Kyan-sen"
Tenkan_Sen.SetDefaultColor(CreateColor(4,150,255));
Kijun_Sen.SetDefaultColor(CreateColor(153,21,21));
Chikou_Span.SetDefaultColor(CreateColor(69,153,21));
Kyan_Sen.SetDefaultColor(CreateColor(255,127,0));


def Upcloud = if ichi then SenkouSpanA[displacement] else na;        # "Senkou Span A"
def Downcloud = if ichi then SenkouSpanB[displacement] else na;      # "Senkou Span B"
AddCloud(Upcloud, Downcloud, Color.DARK_GREEN, Color.DARK_RED);      # "Cloud"

def Upcloud2 = if ichi2 then SenkouSpanA2[displacement2] else na;    # "Senkou Span A"
def Downcloud2 = if ichi2 then SenkouSpanB2[displacement2] else na;  # "Senkou Span B"
AddCloud(Upcloud2, Downcloud2, Color.DARK_GREEN, Color.DARK_RED);    # "Cloud adjust and double"

#---
plot TKupStrong = if (cr1 and cupA) then low else na;#, "UP-S", Color.GREEN, no);
plot TKupAvg = if (cr1 and cupB) then low else na;#, "UP-N", Color.GREEN, no);
plot TKupWeak = if (cr1 and cupC) then low else na;#, "UP-W", Color.GREEN, no);
TKupStrong.SetPaintingStrategy(PaintingStrategy.BOOLEAN_WEDGE_DOWN);
TKupAvg.SetPaintingStrategy(PaintingStrategy.BOOLEAN_WEDGE_DOWN);
TKupWeak.SetPaintingStrategy(PaintingStrategy.BOOLEAN_WEDGE_DOWN);
TKupStrong.SetDefaultColor(Color.CYAN);
TKupAvg.SetDefaultColor(Color.GREEN);
TKupWeak.SetDefaultColor(Color.DARK_GREEN);

plot TKdnStrong = if (cr1 and cdnA) then high else na;# "DN-S", Color.RED, yes);
plot TKdnAvg  = if (cr1 and cdnB) then high else na;#, "DN-N", Color.RED, yes);
plot TKdnWeak = if (cr1 and cdnC) then high else na;#, "DN-W", Color.RED, yes);
TKdnStrong.SetPaintingStrategy(PaintingStrategy.BOOLEAN_WEDGE_UP);
TKdnAvg.SetPaintingStrategy(PaintingStrategy.BOOLEAN_WEDGE_UP);
TKdnWeak.SetPaintingStrategy(PaintingStrategy.BOOLEAN_WEDGE_UP);
TKdnStrong.SetDefaultColor(Color.MAGENTA);
TKdnAvg.SetDefaultColor(Color.RED);
TKdnWeak.SetDefaultColor(Color.DARK_RED);

plot closeUpA = if (cr2 and preflyA) then low else na;#, "Up", Color.GREEN, no);
plot closeUpB = if (cr2 and preflyB) then low else na;#, "Up", Color.GREEN, no);
closeUpA.SetPaintingStrategy(PaintingStrategy.TRIANGLES);
closeUpB.SetPaintingStrategy(PaintingStrategy.TRIANGLES);
closeUpA.SetDefaultColor(Color.GREEN);
closeUpB.SetDefaultColor(Color.DARK_GREEN);

plot closeDnA = if (cr2 and predigA) then high else na;#, "Down", Color.RED, yes);
plot closeDnB = if (cr2 and predigB) then high else na;#, "Down", Color.RED, yes);
closeDnA.SetPaintingStrategy(PaintingStrategy.SQUARES);
closeDnB.SetPaintingStrategy(PaintingStrategy.SQUARES);
closeDnA.SetDefaultColor(Color.RED);
closeDnB.SetDefaultColor(Color.DARK_RED);

plot CSupA = if (cr2 and flyA) then low else na;#, "Fly", Color.GREEN, no);
plot CSupB = if (cr2 and flyB) then low else na;#, "Fly", Color.GREEN, no);
CSupA.SetPaintingStrategy(PaintingStrategy.BOOLEAN_WEDGE_DOWN);
CSupB.SetPaintingStrategy(PaintingStrategy.BOOLEAN_WEDGE_DOWN);
CSupA.SetDefaultColor(Color.GREEN);
CSupB.SetDefaultColor(Color.DARK_GREEN);

plot CSdnA = if (cr2 and digA) then high else na;#, "Dig", Color.RED, yes);
plot CSdnB = if (cr2 and digB) then high else na;#, "Dig", Color.RED, yes);
CSdnA.SetPaintingStrategy(PaintingStrategy.BOOLEAN_WEDGE_UP);
CSdnB.SetPaintingStrategy(PaintingStrategy.BOOLEAN_WEDGE_UP);
CSdnA.SetDefaultColor(Color.RED);
CSdnB.SetDefaultColor(Color.DARK_RED);

#/-----  CANDLE PATTERN ----
#//Doji

def doji = (AbsValue(open - close) <= (high - low) * DojiSize and (AbsValue((high + low)*0.5 - (open + close)*0.5)/(high - low)) <= 0.4);
def flydragondoji = (AbsValue(open - close) <= (high - low) * DojiSize and (((high + low)*0.5 - (open + close)*0.5)/(high - low)) <= -0.4);
def gravestonedoji = (AbsValue(open - close) <= (high - low) * DojiSize and (((high + low)*0.5 - (open + close)*0.5)/(high - low)) >= 0.4);
AddChartBubble(isCandlePatterns and doji, high, "Doji", Color.WHITE, yes);
AddChartBubble(isCandlePatterns and flydragondoji, high, "Flydragon", Color.WHITE, yes);
AddChartBubble(isCandlePatterns and gravestonedoji, high, "Gravestone",Color.WHITE, yes);

#//Evening Star
def estar=(close[2] > open[2] and close < open and AbsValue(close[2] - open[2]) > 4*AbsValue(close[1] - open[1]) and AbsValue(open - close) > 4*AbsValue(close[1] - open[1]));
AddChartBubble(isCandlePatterns and estar, high, "Evening"+"\n"+"Star", color.WHITE, yes);

#//Morning Star
def mstar=(close[2] < open[2] and close > open and AbsValue(close[2] - open[2]) > 4*AbsValue(close[1] - open[1]) and AbsValue(open - close) > 4*AbsValue(close[1] - open[1]));
AddChartBubble(isCandlePatterns and mstar, high, "Morning"+"\n"+"Star", Color.WHITE,yes);

#//Shooting Star
def sstar=(high - max(open, close) >= AbsValue(open - close) * 3 and min(close, open) - low <= AbsValue(open - close)*0.5);
AddChartBubble(isCandlePatterns and sstar, high, "Shooting"+"\n"+"Star", Color.WHITE,yes);

#//Hammer
def hammer=(AbsValue(low - min(open, close)) >= AbsValue(open - close) * 3 and high - max(close, open) <= AbsValue(open - close)*0.5);
AddChartBubble(isCandlePatterns and hammer, high, "Hammer", Color.WHITE,yes);

#//Bearish Harami
def bearH=(close[2] > open[2] and open < close[2] and open > open[2] and close < close[2] and close > open[2] and high < close[2] );
AddChartBubble(isCandlePatterns and bearH, high, "Bearish"+"\n"+"Harami",Color.WHITE, yes);

#//Bullish Harami
def bullH=(close[2] < open[2] and open < open[2] and open > close[2] and close < open[2] and close > close[2] and low > close[2]);
AddChartBubble(isCandlePatterns and bullH, high, "Bullish"+"\n"+"Harami", Color.WHITE,yes);

#//Bearish Engulfing
def bearE=(close[2] > open[2] and close < open and close[2] > close and close[2] < open and open[2] > close and open[2] < open and high[2] < open );
AddChartBubble(isCandlePatterns and bearE, high, "Bearish"+"\n"+"Engulfing", Color.WHITE,yes);

#//Bullish Engulfing
def bullE=(close[2] < open[2] and close > open and close[2] < close and close[2] > open and open[2] < close and open[2] > open and low[2] > open );
AddChartBubble(isCandlePatterns and bullE, high, "Bullish"+"\n"+"Engulfling", Color.WHITE,yes);

#//Dark Cloud Cover
def dcc=((close[2]>open[2])and(((close[2]+open[2])/2)>close)and(open>close)and(open>close[2])and(close>open[2])and((open-close)/(.001+(high-low))>0.6));
AddChartBubble(isCandlePatterns and dcc, high, "Dark"+"\n"+"CloudCover", Color.WHITE,yes);



#-- END of COE
 
check out the below. I didn't test it do you do pls.

CSS:
#//@Crypto_level_UP
#study("Ichimoku Signal + Candle Color + Candle Pattern", overlay = true, shorttitle="Ichi + CC + CP")
# converted by Sam4Cok@Samer800    -06/2023
input ema = no;#(false, title="using ema?")
input lenema = 200;#, minval=1, title="EMA period")
input ColorBars = no;#(false, title="Candle Color ? ")
input CustSession     = no;#(defval=false,title= "Custom Time Frame ? ",type=bool)
input SessionTF0    = AggregationPeriod.HOUR;#(title="Custom Time Frame", type=resolution,defval="60")
input CustSession1     = no;#(defval=false,title= "Custom Time Frame not in menu above ? ",type=bool)
input SessionTF1    = AggregationPeriod.FOUR_HOURS;#(type= string, defval="240",title="Custom Time Frame not in menu above")
input TF_Type        = no;#(type= bool, defval=false,title="TimeFrame HIGHER than Daily ?")
input colbgON        = no;#(type= bool, defval=false,title='Highlight background color with sec. indicator ?')
input isHA         = yes;#(true, "Apply HA Candles Indicator on regular candle", bool)
#//--  INPUT ICHIMOKU --------
input ichi = yes;#(true, title="Ichimoku ? ")
input ichi2 = no;#(false, title="Ichimoku adjust and double ?")
input tenkanPeriods = 9;#, minval=1, title="Tenkan-sen Periods")
input kijunPeriods = 26;#, minval=1, title="Kijun-sen Periods")
input SenkouSpanBPeriods = 52;#, minval=1, title="Senkou Span B Periods")
input displacement = 26;#, minval=1, title="Chikou Periods")
input kyanPeriods = 65;#, minval=1, title="Kyan-sen Periods")
input cr1 = yes;#(true, title="Show Crosses up/down Tenkan-Sen and Kinjun-Sen ?")
input cr2 = yes;#(true, title="Show Crosses up/down Chikou Span and Cloud ?")
#//-  INPUT CANDLE PATTERNS ------
input isCandlePatterns = no;#(false, title = "auto Candle Patterns ?")
input DojiSize = 0.03;#, minval=0.01, title="Doji size")

def na = Double.NaN;

def SessionTF     = if CustSession1 then SessionTF1 else SessionTF0;

def RSI_Lenght0    = 26;
def RSI_Lenght1    = 14;
def OverBought_Band    = 69.1;
def OverSold_Band    = 30.9;
def VIP_Upper    = 61.8;
def VIP_Lower    = 38.2;

def res = if CustSession then SessionTF else GetAggregationPeriod();
#def data         = isHA ? heikenashi(tickerid) : tickerid
def Op = open(Period = res);
def hi = high(Period = res);
def lo = low(Period = res);
def cl = close(Period = res);
def haClose = (Op + hi + lo + cl) / 4;
def haOpen = CompoundValue(1, (haOpen[1] + haClose[1]) / 2, (Op + cl) / 2);
def haHigh = Max(Max(hi, haOpen), haClose);
def haLow = Min(Min(lo, haOpen), haClose);

def o = if isHA then haOpen else Op;
def c = if isHA then haClose else cl;
def l = if isHA then haLow else lo;
def h = if isHA then haHigh else hi;
#//--  INPUT ICHIMOKU --------
def tenkanPeriods2 = 26;
def kijunPeriods2 = 65;
def SenkouSpanBPeriods2 = 129;
def displacement2 = 33;

script donchian {
    input len = 26;
    def hh = Highest(high, len);
    def ll = Lowest(low, len);
    def donchian = (hh + ll) / 2;
    plot out = donchian;
}
#//------ EMA --------//
def emaline = ExpAverage(close, lenema);
plot MovAvgLine = if ema then emaline else na;#, title = "ema line", color = purple)
MovAvgLine.SetDefaultColor(Color.VIOLET);
#//----  ICHIMOKU   --------
def Tenkansen = donchian(tenkanPeriods);
def Kijunsen = donchian(kijunPeriods);
def SenkouSpanA = (Tenkansen + Kijunsen) / 2;
def SenkouSpanB = donchian(SenkouSpanBPeriods);
def Kyansen = donchian(kyanPeriods);
def cloud = SenkouSpanA - SenkouSpanB;

def Tenkansen2 = donchian(tenkanPeriods2);
def Kijunsen2 = donchian(kijunPeriods2);
def SenkouSpanA2 = (Tenkansen2 + Kijunsen2) /2;
def SenkouSpanB2 = donchian(SenkouSpanBPeriods2);
def cloud2 = SenkouSpanA2 - SenkouSpanB2;

def crossup = if Tenkansen[1] < Kijunsen[1] and Tenkansen > Kijunsen then 1 else 0;
def crossdown = if Tenkansen[1] > Kijunsen[1] and Tenkansen < Kijunsen then 1 else 0;
def abovecloud = if close > SenkouSpanA[displacement] and close > SenkouSpanB[displacement] then 1 else 0;
def bellowcloud = if close < SenkouSpanA[displacement] and close < SenkouSpanB[displacement] then 1 else 0;
def incloud = if (close > SenkouSpanA[displacement] and close < SenkouSpanB[displacement]) or (close < SenkouSpanA[displacement] and close > SenkouSpanB[displacement]) then 1 else 0;
def cupA = if crossup == 1 and abovecloud == 1 then crossup else 0;
def cupB = if crossup == 1 and incloud == 1 then crossup else 0;
def cupC = if crossup == 1 and bellowcloud == 1 then crossup else 0;
def cdnA = if crossdown == 1 and bellowcloud == 1 then crossdown else 0;
def cdnB = if crossdown == 1 and incloud == 1 then crossdown else 0;
def cdnC = if crossdown == 1 and abovecloud == 1 then crossdown else 0;

def flyupA = if close[1] < SenkouSpanA[displacement * 2 + 1] and close > SenkouSpanA[displacement * 2] then 1 else 0;
def digdownA = if close[1] > SenkouSpanA[displacement * 2 + 1] and close < SenkouSpanA[displacement * 2] then 1 else 0;
def flyupB = if close[1] < SenkouSpanB[displacement * 2 + 1] and close > SenkouSpanB[displacement * 2] then 1 else 0;
def digdownB = if close[1] > SenkouSpanB[displacement * 2 + 1] and close < SenkouSpanB[displacement * 2] then 1 else 0;
def flyA = if cloud[displacement * 2 + 1] > 0 and flyupA == 1 then 1 else 0;
def flyB = if cloud[displacement * 2 + 1] < 0 and flyupB == 1 then 1 else 0;
def digA = if cloud[displacement * 2 + 1] < 0 and digdownA == 1 then 1 else 0;
def digB = if cloud[displacement * 2 + 1] > 0 and digdownB == 1 then 1 else 0;

def preflyupA = if close[1] < SenkouSpanA[displacement + 1] and close > SenkouSpanA[displacement] then 1 else 0;
def predigdownA = if close[1] > SenkouSpanA[displacement + 1] and close < SenkouSpanA[displacement] then 1 else 0;
def preflyupB = if close[1] < SenkouSpanB[displacement + 1] and close > SenkouSpanB[displacement] then 1 else 0;
def predigdownB = if close[1] > SenkouSpanB[displacement + 1] and close < SenkouSpanB[displacement] then 1 else 0;
def preflyA = if cloud[displacement] > 0 and preflyupA == 1 then 1 else 0;
def preflyB = if cloud[displacement] < 0 and preflyupB == 1 then 1 else 0;
def predigA = if cloud[displacement] < 0 and predigdownA == 1 then 1 else 0;
def predigB = if cloud[displacement] > 0 and predigdownB == 1 then 1 else 0;
 
#//-----------  RSI LINE   -----------

def RSI_Lenght = if TF_Type then RSI_Lenght0 else RSI_Lenght1;

def r0     =  rsi(Price=c, Length=RSI_Lenght);
def r1     =  rsi(Price=c, Length=RSI_Lenght0);

def rsi_sma = Average(r0, 500);

def uprsi     = WildersAverage(max((c-c[1]), 0), RSI_Lenght);
def downrsi   = WildersAverage(-min((c-c[1]), 0), RSI_Lenght);
def Myrsi     = if downrsi == 0 then 100 else
                if uprsi == 0 then 0 else 100 - (100 / (1 + uprsi / downrsi));# //coloring method below
 
def src1 = c; def len1 = OverSold_Band;
def src2 = c; def len2 = VIP_Lower;
def src3 = c; def len3 = rsi_sma;
def src4 = c; def len4 = VIP_Upper;
def src5 = c; def len5 = OverBought_Band;

def issuperoversold = Myrsi < len1;
def isoversold      = Myrsi > len1 and Myrsi < len2;
def issold          = Myrsi > len2 and Myrsi < len3;
def isbought        = Myrsi > len3 and Myrsi < len4;
def isoverbought    = Myrsi > len4 and Myrsi < len5;
def issuperoverbought = Myrsi > len5;

#//-------- CANDLE COLOR -------
def col = if (issuperoversold) then -3 else
          if (isoversold) then -2 else
          if (issold) then -1 else
          if (isbought) then 1 else
          if (isoverbought) then 2 else
          if (issuperoverbought) then 3  else 0; #"Bar Colorization'
AssignPriceColor(if !ColorBars then Color.CURRENT else
                 if col == 3 then Color.CYAN else
                 if col == 2 then Color.GREEN else
                 if col == 1 then Color.DARK_GREEN else
                 if col == -1 then Color.DARK_RED else
                 if col == -2 then Color.RED else
                 if col == -3 then Color.MAGENTA else Color.GRAY);
   
#/------- ICHIMOKU LINE, CLOUD AND SIGNAL --------------//
plot Tenkan_Sen = if ichi then Tenkansen else na;                           # "Tenkan-sen"
plot Kijun_Sen = if (ichi or ichi2) then Kijunsen else na;                  # "Kijun-sen"
plot Chikou_Span = if (ichi or ichi2) then close[-displacement] else na;    # "Chikou Span"
plot Kyan_Sen = if (ichi or ichi2) then Kyansen else na;                    # "Kyan-sen"
Tenkan_Sen.SetDefaultColor(CreateColor(4,150,255));
Kijun_Sen.SetDefaultColor(CreateColor(153,21,21));
Chikou_Span.SetDefaultColor(CreateColor(69,153,21));
Kyan_Sen.SetDefaultColor(CreateColor(255,127,0));


def Upcloud = if ichi then SenkouSpanA[displacement] else na;        # "Senkou Span A"
def Downcloud = if ichi then SenkouSpanB[displacement] else na;      # "Senkou Span B"
AddCloud(Upcloud, Downcloud, Color.DARK_GREEN, Color.DARK_RED);      # "Cloud"

def Upcloud2 = if ichi2 then SenkouSpanA2[displacement2] else na;    # "Senkou Span A"
def Downcloud2 = if ichi2 then SenkouSpanB2[displacement2] else na;  # "Senkou Span B"
AddCloud(Upcloud2, Downcloud2, Color.DARK_GREEN, Color.DARK_RED);    # "Cloud adjust and double"

#---
plot TKupStrong = if (cr1 and cupA) then low else na;#, "UP-S", Color.GREEN, no);
plot TKupAvg = if (cr1 and cupB) then low else na;#, "UP-N", Color.GREEN, no);
plot TKupWeak = if (cr1 and cupC) then low else na;#, "UP-W", Color.GREEN, no);
TKupStrong.SetPaintingStrategy(PaintingStrategy.BOOLEAN_WEDGE_DOWN);
TKupAvg.SetPaintingStrategy(PaintingStrategy.BOOLEAN_WEDGE_DOWN);
TKupWeak.SetPaintingStrategy(PaintingStrategy.BOOLEAN_WEDGE_DOWN);
TKupStrong.SetDefaultColor(Color.CYAN);
TKupAvg.SetDefaultColor(Color.GREEN);
TKupWeak.SetDefaultColor(Color.DARK_GREEN);

plot TKdnStrong = if (cr1 and cdnA) then high else na;# "DN-S", Color.RED, yes);
plot TKdnAvg  = if (cr1 and cdnB) then high else na;#, "DN-N", Color.RED, yes);
plot TKdnWeak = if (cr1 and cdnC) then high else na;#, "DN-W", Color.RED, yes);
TKdnStrong.SetPaintingStrategy(PaintingStrategy.BOOLEAN_WEDGE_UP);
TKdnAvg.SetPaintingStrategy(PaintingStrategy.BOOLEAN_WEDGE_UP);
TKdnWeak.SetPaintingStrategy(PaintingStrategy.BOOLEAN_WEDGE_UP);
TKdnStrong.SetDefaultColor(Color.MAGENTA);
TKdnAvg.SetDefaultColor(Color.RED);
TKdnWeak.SetDefaultColor(Color.DARK_RED);

plot closeUpA = if (cr2 and preflyA) then low else na;#, "Up", Color.GREEN, no);
plot closeUpB = if (cr2 and preflyB) then low else na;#, "Up", Color.GREEN, no);
closeUpA.SetPaintingStrategy(PaintingStrategy.TRIANGLES);
closeUpB.SetPaintingStrategy(PaintingStrategy.TRIANGLES);
closeUpA.SetDefaultColor(Color.GREEN);
closeUpB.SetDefaultColor(Color.DARK_GREEN);

plot closeDnA = if (cr2 and predigA) then high else na;#, "Down", Color.RED, yes);
plot closeDnB = if (cr2 and predigB) then high else na;#, "Down", Color.RED, yes);
closeDnA.SetPaintingStrategy(PaintingStrategy.SQUARES);
closeDnB.SetPaintingStrategy(PaintingStrategy.SQUARES);
closeDnA.SetDefaultColor(Color.RED);
closeDnB.SetDefaultColor(Color.DARK_RED);

plot CSupA = if (cr2 and flyA) then low else na;#, "Fly", Color.GREEN, no);
plot CSupB = if (cr2 and flyB) then low else na;#, "Fly", Color.GREEN, no);
CSupA.SetPaintingStrategy(PaintingStrategy.BOOLEAN_WEDGE_DOWN);
CSupB.SetPaintingStrategy(PaintingStrategy.BOOLEAN_WEDGE_DOWN);
CSupA.SetDefaultColor(Color.GREEN);
CSupB.SetDefaultColor(Color.DARK_GREEN);

plot CSdnA = if (cr2 and digA) then high else na;#, "Dig", Color.RED, yes);
plot CSdnB = if (cr2 and digB) then high else na;#, "Dig", Color.RED, yes);
CSdnA.SetPaintingStrategy(PaintingStrategy.BOOLEAN_WEDGE_UP);
CSdnB.SetPaintingStrategy(PaintingStrategy.BOOLEAN_WEDGE_UP);
CSdnA.SetDefaultColor(Color.RED);
CSdnB.SetDefaultColor(Color.DARK_RED);

#/-----  CANDLE PATTERN ----
#//Doji

def doji = (AbsValue(open - close) <= (high - low) * DojiSize and (AbsValue((high + low)*0.5 - (open + close)*0.5)/(high - low)) <= 0.4);
def flydragondoji = (AbsValue(open - close) <= (high - low) * DojiSize and (((high + low)*0.5 - (open + close)*0.5)/(high - low)) <= -0.4);
def gravestonedoji = (AbsValue(open - close) <= (high - low) * DojiSize and (((high + low)*0.5 - (open + close)*0.5)/(high - low)) >= 0.4);
AddChartBubble(isCandlePatterns and doji, high, "Doji", Color.WHITE, yes);
AddChartBubble(isCandlePatterns and flydragondoji, high, "Flydragon", Color.WHITE, yes);
AddChartBubble(isCandlePatterns and gravestonedoji, high, "Gravestone",Color.WHITE, yes);

#//Evening Star
def estar=(close[2] > open[2] and close < open and AbsValue(close[2] - open[2]) > 4*AbsValue(close[1] - open[1]) and AbsValue(open - close) > 4*AbsValue(close[1] - open[1]));
AddChartBubble(isCandlePatterns and estar, high, "Evening"+"\n"+"Star", color.WHITE, yes);

#//Morning Star
def mstar=(close[2] < open[2] and close > open and AbsValue(close[2] - open[2]) > 4*AbsValue(close[1] - open[1]) and AbsValue(open - close) > 4*AbsValue(close[1] - open[1]));
AddChartBubble(isCandlePatterns and mstar, high, "Morning"+"\n"+"Star", Color.WHITE,yes);

#//Shooting Star
def sstar=(high - max(open, close) >= AbsValue(open - close) * 3 and min(close, open) - low <= AbsValue(open - close)*0.5);
AddChartBubble(isCandlePatterns and sstar, high, "Shooting"+"\n"+"Star", Color.WHITE,yes);

#//Hammer
def hammer=(AbsValue(low - min(open, close)) >= AbsValue(open - close) * 3 and high - max(close, open) <= AbsValue(open - close)*0.5);
AddChartBubble(isCandlePatterns and hammer, high, "Hammer", Color.WHITE,yes);

#//Bearish Harami
def bearH=(close[2] > open[2] and open < close[2] and open > open[2] and close < close[2] and close > open[2] and high < close[2] );
AddChartBubble(isCandlePatterns and bearH, high, "Bearish"+"\n"+"Harami",Color.WHITE, yes);

#//Bullish Harami
def bullH=(close[2] < open[2] and open < open[2] and open > close[2] and close < open[2] and close > close[2] and low > close[2]);
AddChartBubble(isCandlePatterns and bullH, high, "Bullish"+"\n"+"Harami", Color.WHITE,yes);

#//Bearish Engulfing
def bearE=(close[2] > open[2] and close < open and close[2] > close and close[2] < open and open[2] > close and open[2] < open and high[2] < open );
AddChartBubble(isCandlePatterns and bearE, high, "Bearish"+"\n"+"Engulfing", Color.WHITE,yes);

#//Bullish Engulfing
def bullE=(close[2] < open[2] and close > open and close[2] < close and close[2] > open and open[2] < close and open[2] > open and low[2] > open );
AddChartBubble(isCandlePatterns and bullE, high, "Bullish"+"\n"+"Engulfling", Color.WHITE,yes);

#//Dark Cloud Cover
def dcc=((close[2]>open[2])and(((close[2]+open[2])/2)>close)and(open>close)and(open>close[2])and(close>open[2])and((open-close)/(.001+(high-low))>0.6));
AddChartBubble(isCandlePatterns and dcc, high, "Dark"+"\n"+"CloudCover", Color.WHITE,yes);



#-- END of COE
thank you so much
 
Any hints

Have you been using this indicator? I'm curious what info the candle indicators relay.

Are you asking about the candle COLORS?
They represent different OverSold and OverBought Levels of RSI
qv11lsU.png

Colored RSI: https://usethinkscript.com/threads/rsi-format-label-watchlist-scan-for-thinkorswim.798/#post-71110
 

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

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

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