Exit Signal for 8/21 Crossover

LGLyon

New member
I am using an 8/21 ema crossover for an entry signal when 8 ema crosses above or below the 21 ema.

I am looking for help with script for the following:

After an 8 ema crosses above the 21 ema, I want an exit signal on the chart when the Squeeze Pro bar turns dark blue.

when an 8 ema crosses below the 21 ema, I want an exit signal on the chart when the Squeeze Pro bar turns yellow.

I am only using this on a 15 minute and a 5 minute chart.

Is there anyone out there who can help me with that?

Thanks
 
Last edited:
Solution
halcyonguy

Thanks for the input.

The TTM Squeeze study will work.

I have Squeeze Pro.

I do not know how to take parts out of the code or how to write the code to make the exit signal.

I used a replica of the TTM_Squeeze study that I made that disclosed how the histogram's colors were derived. I used this to determine exit signals based upon the colors blue and yellow and the ema crosses.

Capture.jpg

Code:
plot ema8  = expaverage(close, 8);
plot ema21 = expaverage(close, 21);

def histogram = ttm_Squeeze().histogram;
def yellow = if Histogram > Histogram[1] and Histogram > 0
                           then 0
                           else if Histogram > 0 and Histogram < Histogram[1]
                           then 0...
we can't help you unless you share the squeeze code,
but,
if it is a paid study, then don't share it.

if the built in ttm_squeeze study will work, then it might be possible.
https://tlc.thinkorswim.com/center/reference/Tech-Indicators/studies-library/T-U/TTM-Squeeze

here is 1 post on squeeze studies.
https://usethinkscript.com/threads/john-carters-squeeze-pro-indicator-for-thinkorswim-free.4021/
if you find a code mentioned on this site, click on the post #, then copy the link and paste it here in a comment.
 
halcyonguy

Thanks for the input.

The TTM Squeeze study will work.

I have Squeeze Pro.

I do not know how to take parts out of the code or how to write the code to make the exit signal.
 
halcyonguy

Thanks for the input.

The TTM Squeeze study will work.

I have Squeeze Pro.

I do not know how to take parts out of the code or how to write the code to make the exit signal.

I used a replica of the TTM_Squeeze study that I made that disclosed how the histogram's colors were derived. I used this to determine exit signals based upon the colors blue and yellow and the ema crosses.

Capture.jpg

Code:
plot ema8  = expaverage(close, 8);
plot ema21 = expaverage(close, 21);

def histogram = ttm_Squeeze().histogram;
def yellow = if Histogram > Histogram[1] and Histogram > 0
                           then 0
                           else if Histogram > 0 and Histogram < Histogram[1]
                           then 0
                           else if Histogram < 0 and Histogram < Histogram[1]
                           then 0
                           else 1;
plot exityellow = if ema8 crosses below ema21 and yellow then 1 else 0;
exityellow.setpaintingStrategy(paintingStrategy.BOOLEAN_ARROW_DOWN);
exityellow.setdefaultColor(color.yellow);
exityellow.setlineWeight(4);


def blue  = if Histogram > Histogram[1] and Histogram > 0
                           then 0
                           else if Histogram > 0 and Histogram < Histogram[1]
                           then 1
                           else if Histogram < 0 and Histogram < Histogram[1]
                           then 0
                           else 0;
plot exitblue = if ema8 crosses above ema21 and blue then 1 else 0;
exitblue.setpaintingStrategy(paintingStrategy.BOOLEAN_ARROW_up);
exitblue.setdefaultColor(color.blue);
exitblue.setlineWeight(4);
 
Solution

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