HULL MA_X + Ichimoku For ThinkOrSwim

Rrm411

Member
Hi All,

Could someone help me to convert this Trading view Indicator, Very useful Indicator for Intraday traders.

@samer800 , @BenTen Could you please check and help us to get convert this useful indicator it will be much appreciated.

HULL MA_X + Ichimoku

Thanks in advance.

https%3A//i.imgur.com/A6Ni4aE.jpg[/img]']
A6Ni4aE.jpg
 

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

Hi All,

Could someone help me to convert this Trading view Indicator, Very useful Indicator for Intraday traders.

@samer800 , @BenTen Could you please check and help us to get convert this useful indicator it will be much appreciated.

HULL MA_X + Ichimoku

Thanks in advance.

https%3A//i.imgur.com/A6Ni4aE.jpg[/img]']
A6Ni4aE.jpg
check the below

CSS:
#//@emohil
#strategy("Hull MA_X + Ichimoku Kinko Hyo Strategy", shorttitle="Hi",
# Converted by Sam4Cok@Samer800  - 01/2023 - Request from useThinkScript.com member

input LongShortLebel = yes;
input CloseLebel     = yes;
input HullLength       = 12;    # "Double HullMA"
input TenkanSenPeriods = 9;     # "Tenkan Sen Periods"
input KijunSenPeriods  = 24;    # "Kijun Sen Periods"
input SenkouSpanBPeriods = 51;  # "Senkou Span B Periods"
input displacement = 24;        # "Displacement"
input ShowHullLines  = no;
input ShowTenkanSen  = yes;
input ShowKijunSen   = yes;
input ShowChikouSpan = no;
input ShowCloud      = yes;

def na = Double.NaN;
def last = isNaN(Close);

def n1 = HullMovingAvg(close, HullLength);
def n2 = HullMovingAvg(close, HullLength)[1];
def b    = n1 > n2;

#donchian(len) =>
script donchian {
    input len = 24;
    def ll = Lowest(low, len);
    def hh = Highest(high, len);
    def donchian = (hh + ll) / 2;
    plot return = donchian;
}

def TenkanSen = donchian(TenkanSenPeriods);
def KijunSen  = donchian(KijunSenPeriods);
def SenkouSpanA = (TenkanSen + KijunSen) / 2;
def SenkouSpanB = donchian(SenkouSpanBPeriods);
def SenkouSpanH = Max(SenkouSpanA[displacement - 1], SenkouSpanB[displacement - 1]);
def SenkouSpanL = Min(SenkouSpanA[displacement - 1], SenkouSpanB[displacement - 1]);
def ChikouSpan = close[displacement - 1];
def cross = crosses(n1, n2);

plot Hullfast = if last or !ShowHullLines then na else n1;
plot Hullslow = if last or !ShowHullLines then na else n2;
Hullfast.AssignValueColor(if b then Color.DARK_GREEN else Color.RED);
Hullslow.AssignValueColor(if b then Color.DARK_GREEN else Color.RED);

plot circles = if !ShowHullLines then na else if cross then (n1+n2)/2 else na;
circles.SetPaintingStrategy(PaintingStrategy.POINTS);
circles.AssignValueColor(if b then Color.GREEN else Color.RED);
circles.SetLineWeight(4);

plot TenkanSenLine = if !ShowTenkanSen then na else TenkanSen; # "Tenkan Sen"
TenkanSenLine.SetLineWeight(2);
TenkanSenLine.SetDefaultColor(Color.BLUE);

plot KijunSenLine  = if !ShowKijunSen then na else KijunSen;                 # "Kijun Sen"
KijunSenLine.SetLineWeight(2);
KijunSenLine.SetDefaultColor(CreateColor(136,0,0));

plot ChikouSpanLine = if !ShowChikouSpan then na else close[-displacement];    # "Chikou Span"
ChikouSpanLine.SetDefaultColor(Color.GRAY);

def SpanA = SenkouSpanA[displacement];    # "Senkou Span A"
def SpanB = SenkouSpanB[displacement];    # "Senkou Span B"


AddCloud(if !ShowCloud then na else SpanA, SpanB, Color.DARK_GREEN, Color.DARK_RED);

def longCon  = n1>n2 and close>n2 and close>ChikouSpan and close>SenkouSpanH and (TenkanSen>=KijunSen or close>KijunSen);
def shortCon = n1<n2 and close<n2 and close<ChikouSpan and close<SenkouSpanL and (TenkanSen<=KijunSen or close<KijunSen);
def closelong = n1<n2 and (close<n2 or TenkanSen<KijunSen or close<TenkanSen or close<KijunSen or close<SenkouSpanH or close<ChikouSpan);
def closeshort = n1>n2 and (close>n2 or TenkanSen>KijunSen or close>TenkanSen or close>KijunSen or close>SenkouSpanL or close>ChikouSpan);

def dirB; def dirS;
if longCon {
    dirB = yes;
    dirS = no;
    } else
if shortCon {
    dirB = no;
    dirS = yes;
    } else {
    dirB = dirB[1];
    dirS = dirS[1];
}
def closeB; def closeS;
if closelong and dirB {
    closeB = yes;
    closeS = no;
    } else
if closeshort and dirS {
    closeB = no;
    closeS = yes;
    } else {
    closeB = closeB[1];
    closeS = closeS[1];
}

AddChartBubble(LongShortLebel and dirB and !dirB[1] and longCon, low, "Long", Color.GREEN, no);
AddChartBubble(LongShortLebel and dirS and !dirS[1] and shortCon, high, "Short", Color.RED, yes);

AddChartBubble(CloseLebel and closeB and !closeB[1] and closelong, high, "Close", Color.DARK_GREEN, yes);
AddChartBubble(CloseLebel and closeS and !closeS[1] and closeshort, low, "Close", Color.DARK_RED, no);

#----END CODE--
 
check the below

CSS:
#//@emohil
#strategy("Hull MA_X + Ichimoku Kinko Hyo Strategy", shorttitle="Hi",
# Converted by Sam4Cok@Samer800  - 01/2023 - Request from useThinkScript.com member

input LongShortLebel = yes;
input CloseLebel     = yes;
input HullLength       = 12;    # "Double HullMA"
input TenkanSenPeriods = 9;     # "Tenkan Sen Periods"
input KijunSenPeriods  = 24;    # "Kijun Sen Periods"
input SenkouSpanBPeriods = 51;  # "Senkou Span B Periods"
input displacement = 24;        # "Displacement"
input ShowHullLines  = no;
input ShowTenkanSen  = yes;
input ShowKijunSen   = yes;
input ShowChikouSpan = no;
input ShowCloud      = yes;

def na = Double.NaN;
def last = isNaN(Close);

def n1 = HullMovingAvg(close, HullLength);
def n2 = HullMovingAvg(close, HullLength)[1];
def b    = n1 > n2;

#donchian(len) =>
script donchian {
    input len = 24;
    def ll = Lowest(low, len);
    def hh = Highest(high, len);
    def donchian = (hh + ll) / 2;
    plot return = donchian;
}

def TenkanSen = donchian(TenkanSenPeriods);
def KijunSen  = donchian(KijunSenPeriods);
def SenkouSpanA = (TenkanSen + KijunSen) / 2;
def SenkouSpanB = donchian(SenkouSpanBPeriods);
def SenkouSpanH = Max(SenkouSpanA[displacement - 1], SenkouSpanB[displacement - 1]);
def SenkouSpanL = Min(SenkouSpanA[displacement - 1], SenkouSpanB[displacement - 1]);
def ChikouSpan = close[displacement - 1];
def cross = crosses(n1, n2);

plot Hullfast = if last or !ShowHullLines then na else n1;
plot Hullslow = if last or !ShowHullLines then na else n2;
Hullfast.AssignValueColor(if b then Color.DARK_GREEN else Color.RED);
Hullslow.AssignValueColor(if b then Color.DARK_GREEN else Color.RED);

plot circles = if !ShowHullLines then na else if cross then (n1+n2)/2 else na;
circles.SetPaintingStrategy(PaintingStrategy.POINTS);
circles.AssignValueColor(if b then Color.GREEN else Color.RED);
circles.SetLineWeight(4);

plot TenkanSenLine = if !ShowTenkanSen then na else TenkanSen; # "Tenkan Sen"
TenkanSenLine.SetLineWeight(2);
TenkanSenLine.SetDefaultColor(Color.BLUE);

plot KijunSenLine  = if !ShowKijunSen then na else KijunSen;                 # "Kijun Sen"
KijunSenLine.SetLineWeight(2);
KijunSenLine.SetDefaultColor(CreateColor(136,0,0));

plot ChikouSpanLine = if !ShowChikouSpan then na else close[-displacement];    # "Chikou Span"
ChikouSpanLine.SetDefaultColor(Color.GRAY);

def SpanA = SenkouSpanA[displacement];    # "Senkou Span A"
def SpanB = SenkouSpanB[displacement];    # "Senkou Span B"


AddCloud(if !ShowCloud then na else SpanA, SpanB, Color.DARK_GREEN, Color.DARK_RED);

def longCon  = n1>n2 and close>n2 and close>ChikouSpan and close>SenkouSpanH and (TenkanSen>=KijunSen or close>KijunSen);
def shortCon = n1<n2 and close<n2 and close<ChikouSpan and close<SenkouSpanL and (TenkanSen<=KijunSen or close<KijunSen);
def closelong = n1<n2 and (close<n2 or TenkanSen<KijunSen or close<TenkanSen or close<KijunSen or close<SenkouSpanH or close<ChikouSpan);
def closeshort = n1>n2 and (close>n2 or TenkanSen>KijunSen or close>TenkanSen or close>KijunSen or close>SenkouSpanL or close>ChikouSpan);

def dirB; def dirS;
if longCon {
    dirB = yes;
    dirS = no;
    } else
if shortCon {
    dirB = no;
    dirS = yes;
    } else {
    dirB = dirB[1];
    dirS = dirS[1];
}
def closeB; def closeS;
if closelong and dirB {
    closeB = yes;
    closeS = no;
    } else
if closeshort and dirS {
    closeB = no;
    closeS = yes;
    } else {
    closeB = closeB[1];
    closeS = closeS[1];
}

AddChartBubble(LongShortLebel and dirB and !dirB[1] and longCon, low, "Long", Color.GREEN, no);
AddChartBubble(LongShortLebel and dirS and !dirS[1] and shortCon, high, "Short", Color.RED, yes);

AddChartBubble(CloseLebel and closeB and !closeB[1] and closelong, high, "Close", Color.DARK_GREEN, yes);
AddChartBubble(CloseLebel and closeS and !closeS[1] and closeshort, low, "Close", Color.DARK_RED, no);

#----END CODE--
Thank you so much for the quick response @samer800

Excellent Job, really very much appreciated your work.
 
check the below

CSS:
#//@emohil
#strategy("Hull MA_X + Ichimoku Kinko Hyo Strategy", shorttitle="Hi",
# Converted by Sam4Cok@Samer800  - 01/2023 - Request from useThinkScript.com member

input LongShortLebel = yes;
input CloseLebel     = yes;
input HullLength       = 12;    # "Double HullMA"
input TenkanSenPeriods = 9;     # "Tenkan Sen Periods"
input KijunSenPeriods  = 24;    # "Kijun Sen Periods"
input SenkouSpanBPeriods = 51;  # "Senkou Span B Periods"
input displacement = 24;        # "Displacement"
input ShowHullLines  = no;
input ShowTenkanSen  = yes;
input ShowKijunSen   = yes;
input ShowChikouSpan = no;
input ShowCloud      = yes;

def na = Double.NaN;
def last = isNaN(Close);

def n1 = HullMovingAvg(close, HullLength);
def n2 = HullMovingAvg(close, HullLength)[1];
def b    = n1 > n2;

#donchian(len) =>
script donchian {
    input len = 24;
    def ll = Lowest(low, len);
    def hh = Highest(high, len);
    def donchian = (hh + ll) / 2;
    plot return = donchian;
}

def TenkanSen = donchian(TenkanSenPeriods);
def KijunSen  = donchian(KijunSenPeriods);
def SenkouSpanA = (TenkanSen + KijunSen) / 2;
def SenkouSpanB = donchian(SenkouSpanBPeriods);
def SenkouSpanH = Max(SenkouSpanA[displacement - 1], SenkouSpanB[displacement - 1]);
def SenkouSpanL = Min(SenkouSpanA[displacement - 1], SenkouSpanB[displacement - 1]);
def ChikouSpan = close[displacement - 1];
def cross = crosses(n1, n2);

plot Hullfast = if last or !ShowHullLines then na else n1;
plot Hullslow = if last or !ShowHullLines then na else n2;
Hullfast.AssignValueColor(if b then Color.DARK_GREEN else Color.RED);
Hullslow.AssignValueColor(if b then Color.DARK_GREEN else Color.RED);

plot circles = if !ShowHullLines then na else if cross then (n1+n2)/2 else na;
circles.SetPaintingStrategy(PaintingStrategy.POINTS);
circles.AssignValueColor(if b then Color.GREEN else Color.RED);
circles.SetLineWeight(4);

plot TenkanSenLine = if !ShowTenkanSen then na else TenkanSen; # "Tenkan Sen"
TenkanSenLine.SetLineWeight(2);
TenkanSenLine.SetDefaultColor(Color.BLUE);

plot KijunSenLine  = if !ShowKijunSen then na else KijunSen;                 # "Kijun Sen"
KijunSenLine.SetLineWeight(2);
KijunSenLine.SetDefaultColor(CreateColor(136,0,0));

plot ChikouSpanLine = if !ShowChikouSpan then na else close[-displacement];    # "Chikou Span"
ChikouSpanLine.SetDefaultColor(Color.GRAY);

def SpanA = SenkouSpanA[displacement];    # "Senkou Span A"
def SpanB = SenkouSpanB[displacement];    # "Senkou Span B"


AddCloud(if !ShowCloud then na else SpanA, SpanB, Color.DARK_GREEN, Color.DARK_RED);

def longCon  = n1>n2 and close>n2 and close>ChikouSpan and close>SenkouSpanH and (TenkanSen>=KijunSen or close>KijunSen);
def shortCon = n1<n2 and close<n2 and close<ChikouSpan and close<SenkouSpanL and (TenkanSen<=KijunSen or close<KijunSen);
def closelong = n1<n2 and (close<n2 or TenkanSen<KijunSen or close<TenkanSen or close<KijunSen or close<SenkouSpanH or close<ChikouSpan);
def closeshort = n1>n2 and (close>n2 or TenkanSen>KijunSen or close>TenkanSen or close>KijunSen or close>SenkouSpanL or close>ChikouSpan);

def dirB; def dirS;
if longCon {
    dirB = yes;
    dirS = no;
    } else
if shortCon {
    dirB = no;
    dirS = yes;
    } else {
    dirB = dirB[1];
    dirS = dirS[1];
}
def closeB; def closeS;
if closelong and dirB {
    closeB = yes;
    closeS = no;
    } else
if closeshort and dirS {
    closeB = no;
    closeS = yes;
    } else {
    closeB = closeB[1];
    closeS = closeS[1];
}

AddChartBubble(LongShortLebel and dirB and !dirB[1] and longCon, low, "Long", Color.GREEN, no);
AddChartBubble(LongShortLebel and dirS and !dirS[1] and shortCon, high, "Short", Color.RED, yes);

AddChartBubble(CloseLebel and closeB and !closeB[1] and closelong, high, "Close", Color.DARK_GREEN, yes);
AddChartBubble(CloseLebel and closeS and !closeS[1] and closeshort, low, "Close", Color.DARK_RED, no);

#----END CODE--

Hello everyone,
Could someone please add two variable in this code where hull line crossed up and down signals, Basically need mobile arrows to scan, Please do help me on this.
It has only option circle which i can not define in scan to choose up or down, your help much appreciated.
@samer800 Please check the above request and please add arrow for 2 variables in settings (mobile arrows- up & down)

uK7f34K.png
 
Hello everyone,
Could someone please add two variable in this code where hull line crossed up and down signals, Basically need mobile arrows to scan, Please do help me on this.
It has only option circle which i can not define in scan to choose up or down, your help much appreciated.
@samer800 Please check the above request and please add arrow for 2 variables in settings (mobile arrows- up & down)

uK7f34K.png
check if this what you want.

CODE:
CSS:
#//@emohil
#strategy("Hull MA_X + Ichimoku Kinko Hyo Strategy", shorttitle="Hi",
# Converted by Sam4Cok@Samer800  - 01/2023 - Request from useThinkScript.com member

input LongShortLebel = yes;
input CloseLebel     = yes;
input HullLength       = 12;    # "Double HullMA"
input TenkanSenPeriods = 9;     # "Tenkan Sen Periods"
input KijunSenPeriods  = 24;    # "Kijun Sen Periods"
input SenkouSpanBPeriods = 51;  # "Senkou Span B Periods"
input displacement = 24;        # "Displacement"
input ShowHullLines  = no;
input ShowTenkanSen  = yes;
input ShowKijunSen   = yes;
input ShowChikouSpan = no;
input ShowCloud      = yes;

def na = Double.NaN;
def last = isNaN(Close);

def n1 = HullMovingAvg(close, HullLength);
def n2 = HullMovingAvg(close, HullLength)[1];
def b    = n1 > n2;

#donchian(len) =>
script donchian {
    input len = 24;
    def ll = Lowest(low, len);
    def hh = Highest(high, len);
    def donchian = (hh + ll) / 2;
    plot return = donchian;
}

def TenkanSen = donchian(TenkanSenPeriods);
def KijunSen  = donchian(KijunSenPeriods);
def SenkouSpanA = (TenkanSen + KijunSen) / 2;
def SenkouSpanB = donchian(SenkouSpanBPeriods);
def SenkouSpanH = Max(SenkouSpanA[displacement - 1], SenkouSpanB[displacement - 1]);
def SenkouSpanL = Min(SenkouSpanA[displacement - 1], SenkouSpanB[displacement - 1]);
def ChikouSpan = close[displacement - 1];
def cross = crosses(n1, n2);

plot Hullfast = if last or !ShowHullLines then na else n1;
plot Hullslow = if last or !ShowHullLines then na else n2;
Hullfast.AssignValueColor(if b then Color.DARK_GREEN else Color.RED);
Hullslow.AssignValueColor(if b then Color.DARK_GREEN else Color.RED);

plot crossUp = if !ShowHullLines then na else if cross and b then (n1+n2)/2 else na;
crossUp.SetPaintingStrategy(PaintingStrategy.POINTS);
crossUp.SetDefaultColor(Color.CYAN);
crossUp.SetLineWeight(4);

plot crossDn = if !ShowHullLines then na else if cross and !b then (n1+n2)/2 else na;
crossDn.SetPaintingStrategy(PaintingStrategy.POINTS);
crossDn.SetDefaultColor(Color.MAGENTA);
crossDn.SetLineWeight(4);

plot TenkanSenLine = if !ShowTenkanSen then na else TenkanSen; # "Tenkan Sen"
TenkanSenLine.SetLineWeight(2);
TenkanSenLine.SetDefaultColor(Color.BLUE);

plot KijunSenLine  = if !ShowKijunSen then na else KijunSen;                 # "Kijun Sen"
KijunSenLine.SetLineWeight(2);
KijunSenLine.SetDefaultColor(CreateColor(136,0,0));

plot ChikouSpanLine = if !ShowChikouSpan then na else close[-displacement];    # "Chikou Span"
ChikouSpanLine.SetDefaultColor(Color.GRAY);

def SpanA = SenkouSpanA[displacement];    # "Senkou Span A"
def SpanB = SenkouSpanB[displacement];    # "Senkou Span B"


AddCloud(if !ShowCloud then na else SpanA, SpanB, Color.DARK_GREEN, Color.DARK_RED);

def longCon  = n1>n2 and close>n2 and close>ChikouSpan and close>SenkouSpanH and (TenkanSen>=KijunSen or close>KijunSen);
def shortCon = n1<n2 and close<n2 and close<ChikouSpan and close<SenkouSpanL and (TenkanSen<=KijunSen or close<KijunSen);
def closelong = n1<n2 and (close<n2 or TenkanSen<KijunSen or close<TenkanSen or close<KijunSen or close<SenkouSpanH or close<ChikouSpan);
def closeshort = n1>n2 and (close>n2 or TenkanSen>KijunSen or close>TenkanSen or close>KijunSen or close>SenkouSpanL or close>ChikouSpan);

def dirB; def dirS;
if longCon {
    dirB = yes;
    dirS = no;
    } else
if shortCon {
    dirB = no;
    dirS = yes;
    } else {
    dirB = dirB[1];
    dirS = dirS[1];
}
def closeB; def closeS;
if closelong and dirB {
    closeB = yes;
    closeS = no;
    } else
if closeshort and dirS {
    closeB = no;
    closeS = yes;
    } else {
    closeB = closeB[1];
    closeS = closeS[1];
}

AddChartBubble(LongShortLebel and dirB and !dirB[1] and longCon, low, "Long", Color.GREEN, no);
AddChartBubble(LongShortLebel and dirS and !dirS[1] and shortCon, high, "Short", Color.RED, yes);

AddChartBubble(CloseLebel and closeB and !closeB[1] and closelong, high, "Close", Color.DARK_GREEN, yes);
AddChartBubble(CloseLebel and closeS and !closeS[1] and closeshort, low, "Close", Color.DARK_RED, no);

#----END CODE--
 
check if this what you want.

CODE:
CSS:
#//@emohil
#strategy("Hull MA_X + Ichimoku Kinko Hyo Strategy", shorttitle="Hi",
# Converted by Sam4Cok@Samer800  - 01/2023 - Request from useThinkScript.com member

input LongShortLebel = yes;
input CloseLebel     = yes;
input HullLength       = 12;    # "Double HullMA"
input TenkanSenPeriods = 9;     # "Tenkan Sen Periods"
input KijunSenPeriods  = 24;    # "Kijun Sen Periods"
input SenkouSpanBPeriods = 51;  # "Senkou Span B Periods"
input displacement = 24;        # "Displacement"
input ShowHullLines  = no;
input ShowTenkanSen  = yes;
input ShowKijunSen   = yes;
input ShowChikouSpan = no;
input ShowCloud      = yes;

def na = Double.NaN;
def last = isNaN(Close);

def n1 = HullMovingAvg(close, HullLength);
def n2 = HullMovingAvg(close, HullLength)[1];
def b    = n1 > n2;

#donchian(len) =>
script donchian {
    input len = 24;
    def ll = Lowest(low, len);
    def hh = Highest(high, len);
    def donchian = (hh + ll) / 2;
    plot return = donchian;
}

def TenkanSen = donchian(TenkanSenPeriods);
def KijunSen  = donchian(KijunSenPeriods);
def SenkouSpanA = (TenkanSen + KijunSen) / 2;
def SenkouSpanB = donchian(SenkouSpanBPeriods);
def SenkouSpanH = Max(SenkouSpanA[displacement - 1], SenkouSpanB[displacement - 1]);
def SenkouSpanL = Min(SenkouSpanA[displacement - 1], SenkouSpanB[displacement - 1]);
def ChikouSpan = close[displacement - 1];
def cross = crosses(n1, n2);

plot Hullfast = if last or !ShowHullLines then na else n1;
plot Hullslow = if last or !ShowHullLines then na else n2;
Hullfast.AssignValueColor(if b then Color.DARK_GREEN else Color.RED);
Hullslow.AssignValueColor(if b then Color.DARK_GREEN else Color.RED);

plot crossUp = if !ShowHullLines then na else if cross and b then (n1+n2)/2 else na;
crossUp.SetPaintingStrategy(PaintingStrategy.POINTS);
crossUp.SetDefaultColor(Color.CYAN);
crossUp.SetLineWeight(4);

plot crossDn = if !ShowHullLines then na else if cross and !b then (n1+n2)/2 else na;
crossDn.SetPaintingStrategy(PaintingStrategy.POINTS);
crossDn.SetDefaultColor(Color.MAGENTA);
crossDn.SetLineWeight(4);

plot TenkanSenLine = if !ShowTenkanSen then na else TenkanSen; # "Tenkan Sen"
TenkanSenLine.SetLineWeight(2);
TenkanSenLine.SetDefaultColor(Color.BLUE);

plot KijunSenLine  = if !ShowKijunSen then na else KijunSen;                 # "Kijun Sen"
KijunSenLine.SetLineWeight(2);
KijunSenLine.SetDefaultColor(CreateColor(136,0,0));

plot ChikouSpanLine = if !ShowChikouSpan then na else close[-displacement];    # "Chikou Span"
ChikouSpanLine.SetDefaultColor(Color.GRAY);

def SpanA = SenkouSpanA[displacement];    # "Senkou Span A"
def SpanB = SenkouSpanB[displacement];    # "Senkou Span B"


AddCloud(if !ShowCloud then na else SpanA, SpanB, Color.DARK_GREEN, Color.DARK_RED);

def longCon  = n1>n2 and close>n2 and close>ChikouSpan and close>SenkouSpanH and (TenkanSen>=KijunSen or close>KijunSen);
def shortCon = n1<n2 and close<n2 and close<ChikouSpan and close<SenkouSpanL and (TenkanSen<=KijunSen or close<KijunSen);
def closelong = n1<n2 and (close<n2 or TenkanSen<KijunSen or close<TenkanSen or close<KijunSen or close<SenkouSpanH or close<ChikouSpan);
def closeshort = n1>n2 and (close>n2 or TenkanSen>KijunSen or close>TenkanSen or close>KijunSen or close>SenkouSpanL or close>ChikouSpan);

def dirB; def dirS;
if longCon {
    dirB = yes;
    dirS = no;
    } else
if shortCon {
    dirB = no;
    dirS = yes;
    } else {
    dirB = dirB[1];
    dirS = dirS[1];
}
def closeB; def closeS;
if closelong and dirB {
    closeB = yes;
    closeS = no;
    } else
if closeshort and dirS {
    closeB = no;
    closeS = yes;
    } else {
    closeB = closeB[1];
    closeS = closeS[1];
}

AddChartBubble(LongShortLebel and dirB and !dirB[1] and longCon, low, "Long", Color.GREEN, no);
AddChartBubble(LongShortLebel and dirS and !dirS[1] and shortCon, high, "Short", Color.RED, yes);

AddChartBubble(CloseLebel and closeB and !closeB[1] and closelong, high, "Close", Color.DARK_GREEN, yes);
AddChartBubble(CloseLebel and closeS and !closeS[1] and closeshort, low, "Close", Color.DARK_RED, no);

#----END CODE--

Awesome @samer800 this is exactly what i was expecting,
You are truly appreciated, it will help a lot for my scan.

Thank you so much.
 
Here is the strategy version adding orders.

Code:
#//@emohil
#strategy("Hull MA_X + Ichimoku Kinko Hyo Strategy", shorttitle="Hi",
# Converted by Sam4Cok@Samer800  - 01/2023 - Request from useThinkScript.com member
# tradingnumbers - added strategy

input LongShortLebel = yes;
input CloseLebel     = yes;
input HullLength       = 12;    # "Double HullMA"
input TenkanSenPeriods = 9;     # "Tenkan Sen Periods"
input KijunSenPeriods  = 24;    # "Kijun Sen Periods"
input SenkouSpanBPeriods = 51;  # "Senkou Span B Periods"
input displacement = 24;        # "Displacement"
input ShowHullLines  = no;
input ShowTenkanSen  = yes;
input ShowKijunSen   = yes;
input ShowChikouSpan = no;
input ShowCloud      = yes;

def na = Double.NaN;
def last = isNaN(Close);

def n1 = HullMovingAvg(close, HullLength);
def n2 = HullMovingAvg(close, HullLength)[1];
def b    = n1 > n2;

#donchian(len) =>
script donchian {
    input len = 24;
    def ll = Lowest(low, len);
    def hh = Highest(high, len);
    def donchian = (hh + ll) / 2;
    plot return = donchian;
}

def TenkanSen = donchian(TenkanSenPeriods);
def KijunSen  = donchian(KijunSenPeriods);
def SenkouSpanA = (TenkanSen + KijunSen) / 2;
def SenkouSpanB = donchian(SenkouSpanBPeriods);
def SenkouSpanH = Max(SenkouSpanA[displacement - 1], SenkouSpanB[displacement - 1]);
def SenkouSpanL = Min(SenkouSpanA[displacement - 1], SenkouSpanB[displacement - 1]);
def ChikouSpan = close[displacement - 1];
def cross = crosses(n1, n2);

plot Hullfast = if last or !ShowHullLines then na else n1;
plot Hullslow = if last or !ShowHullLines then na else n2;
Hullfast.AssignValueColor(if b then Color.DARK_GREEN else Color.RED);
Hullslow.AssignValueColor(if b then Color.DARK_GREEN else Color.RED);

plot crossUp = if !ShowHullLines then na else if cross and b then (n1+n2)/2 else na;
crossUp.SetPaintingStrategy(PaintingStrategy.POINTS);
crossUp.SetDefaultColor(Color.CYAN);
crossUp.SetLineWeight(4);

plot crossDn = if !ShowHullLines then na else if cross and !b then (n1+n2)/2 else na;
crossDn.SetPaintingStrategy(PaintingStrategy.POINTS);
crossDn.SetDefaultColor(Color.MAGENTA);
crossDn.SetLineWeight(4);

plot TenkanSenLine = if !ShowTenkanSen then na else TenkanSen; # "Tenkan Sen"
TenkanSenLine.SetLineWeight(2);
TenkanSenLine.SetDefaultColor(Color.BLUE);

plot KijunSenLine  = if !ShowKijunSen then na else KijunSen;                 # "Kijun Sen"
KijunSenLine.SetLineWeight(2);
KijunSenLine.SetDefaultColor(CreateColor(136,0,0));

plot ChikouSpanLine = if !ShowChikouSpan then na else close[-displacement];    # "Chikou Span"
ChikouSpanLine.SetDefaultColor(Color.GRAY);

def SpanA = SenkouSpanA[displacement];    # "Senkou Span A"
def SpanB = SenkouSpanB[displacement];    # "Senkou Span B"


AddCloud(if !ShowCloud then na else SpanA, SpanB, Color.DARK_GREEN, Color.DARK_RED);

def longCon  = n1>n2 and close>n2 and close>ChikouSpan and close>SenkouSpanH and (TenkanSen>=KijunSen or close>KijunSen);
def shortCon = n1<n2 and close<n2 and close<ChikouSpan and close<SenkouSpanL and (TenkanSen<=KijunSen or close<KijunSen);
def closelong = n1<n2 and (close<n2 or TenkanSen<KijunSen or close<TenkanSen or close<KijunSen or close<SenkouSpanH or close<ChikouSpan);
def closeshort = n1>n2 and (close>n2 or TenkanSen>KijunSen or close>TenkanSen or close>KijunSen or close>SenkouSpanL or close>ChikouSpan);

def dirB; def dirS;
if longCon {
    dirB = yes;
    dirS = no;
    } else
if shortCon {
    dirB = no;
    dirS = yes;
    } else {
    dirB = dirB[1];
    dirS = dirS[1];
}
def closeB; def closeS;
if closelong and dirB {
    closeB = yes;
    closeS = no;
    } else
if closeshort and dirS {
    closeB = no;
    closeS = yes;
    } else {
    closeB = closeB[1];
    closeS = closeS[1];
}

AddChartBubble(LongShortLebel and dirB and !dirB[1] and longCon, low, "Long", Color.GREEN, no);
AddChartBubble(LongShortLebel and dirS and !dirS[1] and shortCon, high, "Short", Color.RED, yes);

AddChartBubble(CloseLebel and closeB and !closeB[1] and closelong, high, "Close", Color.DARK_GREEN, yes);
AddChartBubble(CloseLebel and closeS and !closeS[1] and closeshort, low, "Close", Color.DARK_RED, no);

addOrder(OrderType.BUY_TO_OPEN, dirB and !dirB[1] and longCon);
addOrder(OrderType.SELL_TO_CLOSE, closeB and !closeB[1] and closelong);

addOrder(OrderType.SELL_TO_OPEN, dirS and !dirS[1] and shortCon);
addOrder(OrderType.BUY_TO_CLOSE, closeS and !closeS[1] and closeshort);

#----END CODE--
 

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

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