Setup 9.1.2.3.4 For ThinkOrSwim

Can anyone convert this to think or swim ? or does anyone has already converted this . Please share it if anyone has it .

https://www.tradingview.com/v/5E0eLcge/
check the below.

CSS:
# https://www.tradingview.com/v/5E0eLcge/
# @alanwmg
#study("Setup 9.1.2.3.4", shorttitle="9.1.2.3.4", overlay=true)
# Converted and mod by Sam4Cok@Samer800    - 12/2023 - request from UseThinkScript.com memeber
input timeframe = {Default "Chart", "Custom"};
input customTimeframe = AggregationPeriod.FIFTEEN_MIN;
input labelStyle = {Default "Bubbles", "Numbers"};
input movAvgType = AverageType.EXPONENTIAL;
input source = FundamentalType.CLOSE;

def na = Double.NaN;
def bubble = labelStyle==labelStyle."Bubbles";
#-- MTF
def tfS = Fundamental(FundamentalType = source);
def tfH = high;
def tfL = low;
def tfC = close;
def mtfS = Fundamental(FundamentalType = source, Period = customTimeframe);
def mtfH = high(Period = customTimeframe);
def mtfL = low(Period = customTimeframe);
def mtfC = close(Period = customTimeframe);
def src; def h; def l; def c;
Switch (timeframe) {
Case "Custom" :
    src = mtfS;
    h   = mtfH;
    l   = mtfL;
    c   = mtfC;
Default :
    src = tfS;
    h   = tfH;
    l   = tfL;
    c   = tfC;
}
#//EMA 9

def ema9 = MovingAverage(movAvgType, src, 9);
def ema9Color = if ema9 > ema9[1] and c > ema9 then 1 else
                if ema9 < ema9[1] and c < ema9 then -1 else 0;

plot MovAvgLine = ema9;#, color=ema9Color, style=line, title="EMA9", linewidth=5)
MovAvgLine.AssignValueColor(if ema9Color > 0 then Color.CYAN else
                            if ema9Color < 0 then Color.MAGENTA else Color.GRAY);
#// ALL SETUPS PRESENTED //
#//SETUP 9.1
def ema91s1 = ema9[5]<ema9[4] and ema9[4]<ema9[3] and ema9[3]<ema9[2] and ema9[2]<ema9[1] and ema9[1]>ema9;
def ema91s2 = c < ema9;

def ema91b1 = ema9[5]>ema9[4] and ema9[4]>ema9[3] and ema9[3]>ema9[2] and ema9[2]>ema9[1] and ema9[1]<ema9;
def ema91b2 = c > ema9;
def cond91b = ema91b1 and ema91b2;
def cond91s = ema91s1 and ema91s2;

plot buy91 = if !bubble and cond91b then 9.1 else na;
plot sell91 = if !bubble and cond91s then 9.1 else na;
buy91.SetPaintingStrategy(PaintingStrategy.VALUES_BELOW);
sell91.SetPaintingStrategy(PaintingStrategy.VALUES_ABOVE);
buy91.SetDefaultColor(Color.GREEN);
sell91.SetDefaultColor(Color.RED);

AddChartBubble(bubble and cond91b and !cond91b[1], low, "9.1", Color.GREEN, no);
AddChartBubble(bubble and cond91s and !cond91s[1], high,"9.1", Color.RED);
#//SETUP 9.2
def ema92b1 = ema9[5]<ema9[4] and ema9[4]<ema9[3] and ema9[3]<ema9[2] and ema9[2]<ema9[1] and ema9[1]<=ema9;
def ema92b2 = ema9>=ema9[1] and c[1]> c[2] and c < l[1];

def ema92s1 = ema9[5]>ema9[4] and ema9[4]>ema9[3] and ema9[3]>ema9[2] and ema9[2]>ema9[1] and ema9[1]>=ema9;
def ema92s2 = ema9<=ema9[1] and c[1] < c[2] and c > h[1];

def cond92b = ema92b1 and ema92b2;
def cond92s = ema92s1 and ema92s2;

plot buy92 = if !bubble and cond92b then 9.2 else na;
plot sell92 = if !bubble and cond92s then 9.2 else na;
buy92.SetPaintingStrategy(PaintingStrategy.VALUES_BELOW);
sell92.SetPaintingStrategy(PaintingStrategy.VALUES_ABOVE);
buy92.SetDefaultColor(Color.GREEN);
sell92.SetDefaultColor(Color.RED);

AddChartBubble(bubble and cond92b and !cond92b[1], low, "9.2", Color.GREEN, no);
AddChartBubble(bubble and cond92s and !cond92s[1], high,"9.2", Color.RED);
#barcolor(cond92b?lime:na)
#barcolor(cond92s?red:na)

#//SETUP 9.3
def ema93b1 = ema9[7]<ema9[6] and ema9[6]<ema9[5] and ema9[5]<ema9[4] and ema9[4]<ema9[3] and ema9[3]<ema9[2] and ema9[2]<ema9[1] and ema9[1]<=ema9;
def ema93b2 = c[1]<c[2] and c<c[2] and c[2]>c[3] and c[1]>l[2];

def ema93s1 = ema9[7]>ema9[6] and ema9[6]>ema9[5] and ema9[5]>ema9[4] and ema9[4]>ema9[3] and ema9[3]>ema9[2] and ema9[2]>ema9[1] and ema9[1]>=ema9;
def ema93s2 = c[1]>c[2] and c>c[2] and c[2]<c[3] and c[1]<h[2];

def cond93b = ema93b1 and ema93b2;
def cond93s = ema93s1 and ema93s2;

plot buy93 = if !bubble and cond93b then 9.3 else na;
plot sell93 = if !bubble and cond93s then 9.3 else na;
buy93.SetPaintingStrategy(PaintingStrategy.VALUES_BELOW);
sell93.SetPaintingStrategy(PaintingStrategy.VALUES_ABOVE);
buy93.SetDefaultColor(Color.GREEN);
sell93.SetDefaultColor(Color.RED);

AddChartBubble(bubble and cond93b and !cond93b[1], low, "9.3", Color.GREEN, no);
AddChartBubble(bubble and cond93s and !cond93s[1], high,"9.3", Color.RED);
#barcolor(cond93b?lime:na)
#barcolor(cond93s?red:na)

#//SETUP 9.4
def ema94b1 = ema9[5]<ema9[4] and ema9[4]<ema9[3] and ema9[3]<ema9[2] and ema9[2]>ema9[1] and ema9[1]<ema9;
def ema94b2 = l>=l[1];

def ema94s1 = ema9[5]>ema9[4] and ema9[4]>ema9[3] and ema9[3]>ema9[2] and ema9[2]<ema9[1] and ema9[1]>ema9;
def ema94s2 = c<ema9;

def cond94b = ema94b1 and ema94b2;
def cond94s = ema94s1 and ema94s2;

plot buy94 = if !bubble and cond94b then 9.4 else na;
plot sell94 = if !bubble and cond94s then 9.4 else na;
buy94.SetPaintingStrategy(PaintingStrategy.VALUES_BELOW);
sell94.SetPaintingStrategy(PaintingStrategy.VALUES_ABOVE);
buy94.SetDefaultColor(Color.GREEN);
sell94.SetDefaultColor(Color.RED);

AddChartBubble(bubble and cond94b and !cond94b[1], low, "9.4", Color.GREEN, no);
AddChartBubble(bubble and cond94s and !cond94s[1], high,"9.4", Color.RED);

#-- END of CODE
 
check the below.

CSS:
# https://www.tradingview.com/v/5E0eLcge/
# @alanwmg
#study("Setup 9.1.2.3.4", shorttitle="9.1.2.3.4", overlay=true)
# Converted and mod by Sam4Cok@Samer800    - 12/2023 - request from UseThinkScript.com memeber
input timeframe = {Default "Chart", "Custom"};
input customTimeframe = AggregationPeriod.FIFTEEN_MIN;
input labelStyle = {Default "Bubbles", "Numbers"};
input movAvgType = AverageType.EXPONENTIAL;
input source = FundamentalType.CLOSE;

def na = Double.NaN;
def bubble = labelStyle==labelStyle."Bubbles";
#-- MTF
def tfS = Fundamental(FundamentalType = source);
def tfH = high;
def tfL = low;
def tfC = close;
def mtfS = Fundamental(FundamentalType = source, Period = customTimeframe);
def mtfH = high(Period = customTimeframe);
def mtfL = low(Period = customTimeframe);
def mtfC = close(Period = customTimeframe);
def src; def h; def l; def c;
Switch (timeframe) {
Case "Custom" :
    src = mtfS;
    h   = mtfH;
    l   = mtfL;
    c   = mtfC;
Default :
    src = tfS;
    h   = tfH;
    l   = tfL;
    c   = tfC;
}
#//EMA 9

def ema9 = MovingAverage(movAvgType, src, 9);
def ema9Color = if ema9 > ema9[1] and c > ema9 then 1 else
                if ema9 < ema9[1] and c < ema9 then -1 else 0;

plot MovAvgLine = ema9;#, color=ema9Color, style=line, title="EMA9", linewidth=5)
MovAvgLine.AssignValueColor(if ema9Color > 0 then Color.CYAN else
                            if ema9Color < 0 then Color.MAGENTA else Color.GRAY);
#// ALL SETUPS PRESENTED //
#//SETUP 9.1
def ema91s1 = ema9[5]<ema9[4] and ema9[4]<ema9[3] and ema9[3]<ema9[2] and ema9[2]<ema9[1] and ema9[1]>ema9;
def ema91s2 = c < ema9;

def ema91b1 = ema9[5]>ema9[4] and ema9[4]>ema9[3] and ema9[3]>ema9[2] and ema9[2]>ema9[1] and ema9[1]<ema9;
def ema91b2 = c > ema9;
def cond91b = ema91b1 and ema91b2;
def cond91s = ema91s1 and ema91s2;

plot buy91 = if !bubble and cond91b then 9.1 else na;
plot sell91 = if !bubble and cond91s then 9.1 else na;
buy91.SetPaintingStrategy(PaintingStrategy.VALUES_BELOW);
sell91.SetPaintingStrategy(PaintingStrategy.VALUES_ABOVE);
buy91.SetDefaultColor(Color.GREEN);
sell91.SetDefaultColor(Color.RED);

AddChartBubble(bubble and cond91b and !cond91b[1], low, "9.1", Color.GREEN, no);
AddChartBubble(bubble and cond91s and !cond91s[1], high,"9.1", Color.RED);
#//SETUP 9.2
def ema92b1 = ema9[5]<ema9[4] and ema9[4]<ema9[3] and ema9[3]<ema9[2] and ema9[2]<ema9[1] and ema9[1]<=ema9;
def ema92b2 = ema9>=ema9[1] and c[1]> c[2] and c < l[1];

def ema92s1 = ema9[5]>ema9[4] and ema9[4]>ema9[3] and ema9[3]>ema9[2] and ema9[2]>ema9[1] and ema9[1]>=ema9;
def ema92s2 = ema9<=ema9[1] and c[1] < c[2] and c > h[1];

def cond92b = ema92b1 and ema92b2;
def cond92s = ema92s1 and ema92s2;

plot buy92 = if !bubble and cond92b then 9.2 else na;
plot sell92 = if !bubble and cond92s then 9.2 else na;
buy92.SetPaintingStrategy(PaintingStrategy.VALUES_BELOW);
sell92.SetPaintingStrategy(PaintingStrategy.VALUES_ABOVE);
buy92.SetDefaultColor(Color.GREEN);
sell92.SetDefaultColor(Color.RED);

AddChartBubble(bubble and cond92b and !cond92b[1], low, "9.2", Color.GREEN, no);
AddChartBubble(bubble and cond92s and !cond92s[1], high,"9.2", Color.RED);
#barcolor(cond92b?lime:na)
#barcolor(cond92s?red:na)

#//SETUP 9.3
def ema93b1 = ema9[7]<ema9[6] and ema9[6]<ema9[5] and ema9[5]<ema9[4] and ema9[4]<ema9[3] and ema9[3]<ema9[2] and ema9[2]<ema9[1] and ema9[1]<=ema9;
def ema93b2 = c[1]<c[2] and c<c[2] and c[2]>c[3] and c[1]>l[2];

def ema93s1 = ema9[7]>ema9[6] and ema9[6]>ema9[5] and ema9[5]>ema9[4] and ema9[4]>ema9[3] and ema9[3]>ema9[2] and ema9[2]>ema9[1] and ema9[1]>=ema9;
def ema93s2 = c[1]>c[2] and c>c[2] and c[2]<c[3] and c[1]<h[2];

def cond93b = ema93b1 and ema93b2;
def cond93s = ema93s1 and ema93s2;

plot buy93 = if !bubble and cond93b then 9.3 else na;
plot sell93 = if !bubble and cond93s then 9.3 else na;
buy93.SetPaintingStrategy(PaintingStrategy.VALUES_BELOW);
sell93.SetPaintingStrategy(PaintingStrategy.VALUES_ABOVE);
buy93.SetDefaultColor(Color.GREEN);
sell93.SetDefaultColor(Color.RED);

AddChartBubble(bubble and cond93b and !cond93b[1], low, "9.3", Color.GREEN, no);
AddChartBubble(bubble and cond93s and !cond93s[1], high,"9.3", Color.RED);
#barcolor(cond93b?lime:na)
#barcolor(cond93s?red:na)

#//SETUP 9.4
def ema94b1 = ema9[5]<ema9[4] and ema9[4]<ema9[3] and ema9[3]<ema9[2] and ema9[2]>ema9[1] and ema9[1]<ema9;
def ema94b2 = l>=l[1];

def ema94s1 = ema9[5]>ema9[4] and ema9[4]>ema9[3] and ema9[3]>ema9[2] and ema9[2]<ema9[1] and ema9[1]>ema9;
def ema94s2 = c<ema9;

def cond94b = ema94b1 and ema94b2;
def cond94s = ema94s1 and ema94s2;

plot buy94 = if !bubble and cond94b then 9.4 else na;
plot sell94 = if !bubble and cond94s then 9.4 else na;
buy94.SetPaintingStrategy(PaintingStrategy.VALUES_BELOW);
sell94.SetPaintingStrategy(PaintingStrategy.VALUES_ABOVE);
buy94.SetDefaultColor(Color.GREEN);
sell94.SetDefaultColor(Color.RED);

AddChartBubble(bubble and cond94b and !cond94b[1], low, "9.4", Color.GREEN, no);
AddChartBubble(bubble and cond94s and !cond94s[1], high,"9.4", Color.RED);

#-- END of CODE
thank you so much
 

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
350 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