Symbols appear on Price when EMA 10 cross above EMA20

LLP

Member
VIP
Hi guys, how to make this appear on the price, when EMA10 crosses above EMA20?
with special symbols, CHANGEABLE , like, star , triangle? also color CHANGEABLE?

The thinkscripteditor code is :

MovAvgExponential("length" = 10)."AvgExp" crosses above MovAvgExponential("length" = 20)."AvgExp"
 

Attachments

  • Screenshot 2023-08-17 002842.png
    Screenshot 2023-08-17 002842.png
    396.7 KB · Views: 151
Hi guys, how to make this appear on the price, when EMA10 crosses above EMA20?
with special symbols, CHANGEABLE , like, star , triangle? also color CHANGEABLE?

The thinkscripteditor code is :

MovAvgExponential("length" = 10)."AvgExp" crosses above MovAvgExponential("length" = 20)."AvgExp"

this will draw shapes when an average crosses another average
can change the shape, color, size

Code:
# ema10_cross_20_chg

#https://usethinkscript.com/threads/symbols-appear-on-price-when-ema-10-cross-above-ema20.16402/
#Symbols appear on Price when EMA 10 cross above EMA20

def na = double.nan;
def bn = barnumber();
def price = close;

input avg1_len = 10;
input avg1_type =  AverageType.EXPONENTIAL;
def avg1 = MovingAverage(avg1_type, price, avg1_len);

input avg2_len = 20;
input avg2_type =  AverageType.EXPONENTIAL;
def avg2 = MovingAverage(avg2_type, price, avg2_len);

def xup = avg1 crosses above avg2;
def xdwn = avg1 crosses below avg2;

input show_lines = yes;
plot z1 = if show_lines then avg1 else na;
z1.setdefaultcolor(getcolor(1));
#z1.setlineweight(1);
z1.hidebubble();

plot z2 = if show_lines then avg2 else na;
z2.setdefaultcolor(getcolor(2));
#z2.setlineweight(1);
z2.hidebubble();



#  this doesn't assign the color in quotes.
#  the location of the picked color in the series, is changed to a number
#   ex. pink is the 3rd number. (0-9)  2 is saved in color1_choice ( count starts at 0)
input cross_up_color = { "magenta", default "cyan", "pink", "gray", "orange", "red", "green", "dark_gray", "yellow", "white"};
input cross_up_shape = { DASH, default POINT, SQUARE, TRIANGLE, ARROW_UP, ARROW_DOWN };
input shape_size = 3;
input cross_down_color = { "magenta", "cyan", default "pink", "gray", "orange", "red", "green", "dark_gray", "yellow", "white"};
input cross_down_shape = { DASH, default POINT, SQUARE, TRIANGLE, ARROW_UP, ARROW_DOWN };


def plotupy = low * 0.998;
def plotdwny = high * 1.002;

plot zu1 = if xup and cross_up_shape == cross_up_shape.dash then plotupy else na;
zu1.SetPaintingStrategy(PaintingStrategy.DASHES);
zu1.SetDefaultColor(getcolor(cross_up_color));
zu1.setlineweight(shape_size);
zu1.hidebubble();

plot zu2 = if xup and cross_up_shape == cross_up_shape.point then plotupy else na;
zu2.SetPaintingStrategy(PaintingStrategy.POINTS);
zu2.SetDefaultColor(getcolor(cross_up_color));
zu2.setlineweight(shape_size);
zu2.hidebubble();

plot zu3 = if xup and cross_up_shape == cross_up_shape.square then plotupy else na;
zu3.SetPaintingStrategy(PaintingStrategy.SQUARES);
zu3.SetDefaultColor(getcolor(cross_up_color));
zu3.setlineweight(shape_size);
zu3.hidebubble();

plot zu4 = if xup and cross_up_shape == cross_up_shape.triangle then plotupy else na;
zu4.SetPaintingStrategy(PaintingStrategy.TRIANGLES);
zu4.SetDefaultColor(getcolor(cross_up_color));
zu4.setlineweight(shape_size);
zu4.hidebubble();

plot zu5 = if xup and cross_up_shape == cross_up_shape.arrow_up then plotupy else na;
zu5.SetPaintingStrategy(PaintingStrategy.ARROW_UP);
zu5.SetDefaultColor(getcolor(cross_up_color));
zu5.setlineweight(shape_size);
zu5.hidebubble();

plot zu6 = if xup and cross_up_shape == cross_up_shape.arrow_down then plotupy else na;
zu6.SetPaintingStrategy(PaintingStrategy.ARROW_down);
zu6.SetDefaultColor(getcolor(cross_up_color));
zu6.setlineweight(shape_size);
zu6.hidebubble();


plot zd1 = if xdwn and cross_down_shape == cross_down_shape.dash then plotdwny else na;
zd1.SetPaintingStrategy(PaintingStrategy.DASHES);
zd1.SetDefaultColor(getcolor(cross_up_color));
zd1.setlineweight(shape_size);
zd1.hidebubble();

plot zd2 = if xdwn and cross_down_shape == cross_down_shape.point then plotdwny else na;
zd2.SetPaintingStrategy(PaintingStrategy.POINTS);
zd2.SetDefaultColor(getcolor(cross_down_color));
zd2.setlineweight(shape_size);
zd2.hidebubble();

plot zd3 = if xdwn and cross_down_shape == cross_down_shape.square then plotdwny else na;
zd3.SetPaintingStrategy(PaintingStrategy.SQUARES);
zd3.SetDefaultColor(getcolor(cross_down_color));
zd3.setlineweight(shape_size);
zd3.hidebubble();

plot zd4 = if xdwn and cross_down_shape == cross_down_shape.triangle then plotdwny else na;
zd4.SetPaintingStrategy(PaintingStrategy.TRIANGLES);
zd4.SetDefaultColor(getcolor(cross_up_color));
zd4.setlineweight(shape_size);
zd4.hidebubble();

plot zd5 = if xdwn and cross_down_shape == cross_down_shape.arrow_up then plotdwny else na;
zd5.SetPaintingStrategy(PaintingStrategy.ARROW_UP);
zd5.SetDefaultColor(getcolor(cross_down_color));
zd5.setlineweight(shape_size);
zd5.hidebubble();

plot zd6 = if xdwn and cross_down_shape == cross_down_shape.arrow_down then plotdwny else na;
zd6.SetPaintingStrategy(PaintingStrategy.ARROW_down);
zd6.SetDefaultColor(getcolor(cross_down_color));
zd6.setlineweight(shape_size);
zd6.hidebubble();
#
 
  • Gold STAR
Reactions: LLP
this will draw shapes when an average crosses another average
can change the shape, color, size

Code:
# ema10_cross_20_chg

#https://usethinkscript.com/threads/symbols-appear-on-price-when-ema-10-cross-above-ema20.16402/
#Symbols appear on Price when EMA 10 cross above EMA20

def na = double.nan;
def bn = barnumber();
def price = close;

input avg1_len = 10;
input avg1_type =  AverageType.EXPONENTIAL;
def avg1 = MovingAverage(avg1_type, price, avg1_len);

input avg2_len = 20;
input avg2_type =  AverageType.EXPONENTIAL;
def avg2 = MovingAverage(avg2_type, price, avg2_len);

def xup = avg1 crosses above avg2;
def xdwn = avg1 crosses below avg2;

input show_lines = yes;
plot z1 = if show_lines then avg1 else na;
z1.setdefaultcolor(getcolor(1));
#z1.setlineweight(1);
z1.hidebubble();

plot z2 = if show_lines then avg2 else na;
z2.setdefaultcolor(getcolor(2));
#z2.setlineweight(1);
z2.hidebubble();



#  this doesn't assign the color in quotes.
#  the location of the picked color in the series, is changed to a number
#   ex. pink is the 3rd number. (0-9)  2 is saved in color1_choice ( count starts at 0)
input cross_up_color = { "magenta", default "cyan", "pink", "gray", "orange", "red", "green", "dark_gray", "yellow", "white"};
input cross_up_shape = { DASH, default POINT, SQUARE, TRIANGLE, ARROW_UP, ARROW_DOWN };
input shape_size = 3;
input cross_down_color = { "magenta", "cyan", default "pink", "gray", "orange", "red", "green", "dark_gray", "yellow", "white"};
input cross_down_shape = { DASH, default POINT, SQUARE, TRIANGLE, ARROW_UP, ARROW_DOWN };


def plotupy = low * 0.998;
def plotdwny = high * 1.002;

plot zu1 = if xup and cross_up_shape == cross_up_shape.dash then plotupy else na;
zu1.SetPaintingStrategy(PaintingStrategy.DASHES);
zu1.SetDefaultColor(getcolor(cross_up_color));
zu1.setlineweight(shape_size);
zu1.hidebubble();

plot zu2 = if xup and cross_up_shape == cross_up_shape.point then plotupy else na;
zu2.SetPaintingStrategy(PaintingStrategy.POINTS);
zu2.SetDefaultColor(getcolor(cross_up_color));
zu2.setlineweight(shape_size);
zu2.hidebubble();

plot zu3 = if xup and cross_up_shape == cross_up_shape.square then plotupy else na;
zu3.SetPaintingStrategy(PaintingStrategy.SQUARES);
zu3.SetDefaultColor(getcolor(cross_up_color));
zu3.setlineweight(shape_size);
zu3.hidebubble();

plot zu4 = if xup and cross_up_shape == cross_up_shape.triangle then plotupy else na;
zu4.SetPaintingStrategy(PaintingStrategy.TRIANGLES);
zu4.SetDefaultColor(getcolor(cross_up_color));
zu4.setlineweight(shape_size);
zu4.hidebubble();

plot zu5 = if xup and cross_up_shape == cross_up_shape.arrow_up then plotupy else na;
zu5.SetPaintingStrategy(PaintingStrategy.ARROW_UP);
zu5.SetDefaultColor(getcolor(cross_up_color));
zu5.setlineweight(shape_size);
zu5.hidebubble();

plot zu6 = if xup and cross_up_shape == cross_up_shape.arrow_down then plotupy else na;
zu6.SetPaintingStrategy(PaintingStrategy.ARROW_down);
zu6.SetDefaultColor(getcolor(cross_up_color));
zu6.setlineweight(shape_size);
zu6.hidebubble();


plot zd1 = if xdwn and cross_down_shape == cross_down_shape.dash then plotdwny else na;
zd1.SetPaintingStrategy(PaintingStrategy.DASHES);
zd1.SetDefaultColor(getcolor(cross_up_color));
zd1.setlineweight(shape_size);
zd1.hidebubble();

plot zd2 = if xdwn and cross_down_shape == cross_down_shape.point then plotdwny else na;
zd2.SetPaintingStrategy(PaintingStrategy.POINTS);
zd2.SetDefaultColor(getcolor(cross_down_color));
zd2.setlineweight(shape_size);
zd2.hidebubble();

plot zd3 = if xdwn and cross_down_shape == cross_down_shape.square then plotdwny else na;
zd3.SetPaintingStrategy(PaintingStrategy.SQUARES);
zd3.SetDefaultColor(getcolor(cross_down_color));
zd3.setlineweight(shape_size);
zd3.hidebubble();

plot zd4 = if xdwn and cross_down_shape == cross_down_shape.triangle then plotdwny else na;
zd4.SetPaintingStrategy(PaintingStrategy.TRIANGLES);
zd4.SetDefaultColor(getcolor(cross_up_color));
zd4.setlineweight(shape_size);
zd4.hidebubble();

plot zd5 = if xdwn and cross_down_shape == cross_down_shape.arrow_up then plotdwny else na;
zd5.SetPaintingStrategy(PaintingStrategy.ARROW_UP);
zd5.SetDefaultColor(getcolor(cross_down_color));
zd5.setlineweight(shape_size);
zd5.hidebubble();

plot zd6 = if xdwn and cross_down_shape == cross_down_shape.arrow_down then plotdwny else na;
zd6.SetPaintingStrategy(PaintingStrategy.ARROW_down);
zd6.SetDefaultColor(getcolor(cross_down_color));
zd6.setlineweight(shape_size);
zd6.hidebubble();
#
Biggest size for the dot is size 5? I try size 6 onwards it went blank? why?
 

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