Ichimoku Breakout For ThinkOrSwim

doeoner

New member
Hey everyone, I've read through the Ichimoku post's and can't seem to find a break out indicator. I'm looking to set an alert when a candle breaks out from either side of the cloud (green or red) and EMA 8 crosses EMA 50 all within the same candle. Any help is greatly appreciated.
 

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

This should get you started at least. Feel free to modify it to your liking.

Code:
input tenkan_period = 9;
input kijun_period = 26;

plot Tenkan = (Highest(high, tenkan_period) + Lowest(low, tenkan_period)) / 2;
plot Kijun = (Highest(high, kijun_period) + Lowest(low, kijun_period)) / 2;
plot "Span A" = (Tenkan[kijun_period] + Kijun[kijun_period]) / 2;
plot "Span B" = (Highest(high[kijun_period], 2 * kijun_period) + Lowest(low[kijun_period], 2 * kijun_period)) / 2;
plot Chikou = close[-kijun_period];

Tenkan.SetDefaultColor(GetColor(1));
Kijun.SetDefaultColor(GetColor(2));
"Span A".SetDefaultColor(GetColor(3));
"Span B".SetDefaultColor(GetColor(4));
Chikou.SetDefaultColor(color.dark_red);

DefineGlobalColor("Bullish", Color.YELLOW);
DefineGlobalColor("Bearish", Color.RED);
AddCloud("Span A", "Span B", globalColor("Bullish"), globalColor("Bearish"));



# alert signals
input showAlerts = yes;
input showOutsideCrosses = no;
#input strictMode = no;
input offset = .002;

def SpanUp = if "Span A" > "Span B" then "Span A" else "Span B";
def SpanDn = if "Span A" < "Span B" then "Span A" else "Span B";

def upTrigger1 = if showAlerts and tenkan > kijun and close crosses above SpanUp then 1 else 0;
def dnTrigger1 = if showAlerts and tenkan < kijun and close crosses below SpanDn then 1 else 0;

def upTrigger2 = if showAlerts and showOutsideCrosses and close > SpanUp and tenkan crosses above Kijun then 1 else 0;
def dnTrigger2 = if showAlerts and showOutsideCrosses and close < SpanDn and tenkan crosses below Kijun then 1 else 0;

plot UpSignal = if upTrigger1 or upTrigger2 then low - offset else Double.NaN;
plot DownSignal = if dnTrigger1 or dnTrigger2 then high + offset else Double.NaN;

UpSignal.SetDefaultColor(Color.magenta);
UpSignal.SetPaintingStrategy(PaintingStrategy.ARROW_UP);
UpSignal.setLineWeight(3);
UpSignal.hideBubble();
DownSignal.SetDefaultColor(Color.magenta);
DownSignal.SetPaintingStrategy(PaintingStrategy.ARROW_DOWN);
DownSignal.setLineWeight(3);
DownSignal.hideBubble();

#test
#def dataPoint = close[-26];
#plot crossUp = if "Span A" crosses above "Span B" then "Span B" - offset else Double.NaN;
#plot crossDn = if "Span A" crosses below "Span B" then "Span B" + offset else Double.NaN;
#plot crossUp = if upTrigger then dataPoint - offset else Double.NaN;
#plot crossDn = if dnTrigger then dataPoint + offset else Double.NaN;
#crossUp.SetDefaultColor(Color.blue);
#crossUp.SetPaintingStrategy(PaintingStrategy.ARROW_UP);
#crossUp.setLineWeight(3);
#crossUp.hideBubble();
#crossDn.SetDefaultColor(Color.blue);
#crossDn.SetPaintingStrategy(PaintingStrategy.ARROW_DOWN);
#crossDn.setLineWeight(3);
#crossDn.hideBubble();



input audioAlerts = no;
def aUp = if upSignal and audioalerts and showAlerts then upSignal else Double.NaN;
def aDown = if downSignal and audioalerts and showAlerts then downSignal else Double.NaN;

Alert(aUp, "ICHI BUY", Alert.BAR, Sound.Bell );
Alert(aDown, "ICHI SELL", Alert.BAR, Sound.Bell );
 

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

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