TEMA CROSSOVER

stormy77

Member
Greetings!
I'm trying to create a TEMA cross over chart AND label
For example: 5/14 day
and a label so when the shorter line crosses over the longer line, the label shows "Bullish" and turns green. It would turn red when lines reverse.
Ultimately, I may want to add one for a shorter term indicator and one for medium term (say 20/50)

even more idea would be to identify different levels. example, if the 5 crosses above 14, it would show "slightly bullish", but once it goes at least 2 ticks over then we could show "bullish" and so on. I hope I'm making sense.
Here's the code I have but need to fine tune it and add labels

Code:
input price = close;
input length = 5;
input length2 = 14;

def ema1 = ExpAverage(price, length);
def ema2 = ExpAverage(ema1, length);
def ema3 = ExpAverage(ema2, length);

def ema1a = ExpAverage(price, length2);
def ema2a = ExpAverage(ema1a, length2);
def ema3a = ExpAverage(ema2a, length2);

plot TEMA = 3 * ema1 - 3 * ema2 + ema3;
TEMA.SetDefaultColor(GetColor(0));

plot TEMA2 = 3 * ema1a - 3 * ema2a + ema3a;
TEMA2.SetDefaultColor(GetColor(1));
 
Greetings!
I'm trying to create a TEMA cross over chart AND label
For example: 5/14 day
and a label so when the shorter line crosses over the longer line, the label shows "Bullish" and turns green. It would turn red when lines reverse.
Ultimately, I may want to add one for a shorter term indicator and one for medium term (say 20/50)

even more idea would be to identify different levels. example, if the 5 crosses above 14, it would show "slightly bullish", but once it goes at least 2 ticks over then we could show "bullish" and so on. I hope I'm making sense.
Here's the code I have but need to fine tune it and add labels

Stormy,

This script shows the TEMAs and adds chart labels that appear as green "BULLISH" when 5 is above 14 and show red "BEARISH" when 5 is below 14. Perhaps this could get you started on the more complex version you mentioned...

Below: bullish and bearish example charts, followed by the code


Bullish-temacross2.png



Bearish-temacross2.png



Code:
# TEMA_cross2
# stormy77 request

input price = close;
input length = 5;
input length2 = 14;
input LabelsOn = yes;

def ema1 = ExpAverage(price, length);
def ema2 = ExpAverage(ema1, length);
def ema3 = ExpAverage(ema2, length);
def shortTEMA = 3 * ema1 - 3 * ema2 + ema3;

def ema4 = ExpAverage(price, length2);
def ema5 = ExpAverage(ema4, length2);
def ema6 = ExpAverage(ema5, length2);
def longTEMA = 3 * ema4 - 3 * ema5 + ema6;

plot fastTEMA = shortTEMA;
plot slowTEMA = longTEMA;

fastTEMA.SetDefaultColor(Color.MAGENTA);
slowTEMA.SetDefaultColor(Color.CYAN);

AddLabel(yes, “Bullish”, if fastTEMA > slowTEMA then Color.GREEN else Color.GRAY);
AddLabel(yes, “Bearish”, if fastTEMA < slowTEMA then Color.RED else Color.GRAY);
 
Last edited:

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