# how to add arrow up/down when lines cross?

#### randomx

##### New member
hi all,
bullish: how do i add an green arrow up when the super fast line comes from below crossing the other two lines?
bearish: how do i add an green arrow down when the super fast line comes from above crossing the other two lines?

Code:
``````input price = close;
input superfast_length = 8;
input fast_length = 13;
input slow_length = 21;
input displace = 0;

def mov_avg8 = ExpAverage(price[-displace], superfast_length);
def mov_avg13 = ExpAverage(price[-displace], fast_length);
def mov_avg21 = ExpAverage(price[-displace], slow_length);

#moving averages
Plot Superfast = mov_avg8;
plot Fast = mov_avg13;
plot Slow = mov_avg21;``````

Last edited:
hi all,
bullish: how do i add an green arrow up when the super fast line comes from below crossing the other two lines?
bearish: how do i add an green arrow down when the super fast line comes from above crossing the other two lines?

Code:
``````input price = close;
input superfast_length = 8;
input fast_length = 13;
input slow_length = 21;
input displace = 0;

def mov_avg8 = ExpAverage(price[-displace], superfast_length);
def mov_avg13 = ExpAverage(price[-displace], fast_length);
def mov_avg21 = ExpAverage(price[-displace], slow_length);

#moving averages
Plot Superfast = mov_avg8;
plot Fast = mov_avg13;
plot Slow = mov_avg21;``````
@randomx Here's something to add to your code. You can use as-is or change the conditions.
Ruby:
``````plot cross_above = mov_avg8 crosses above mov_avg21 and mov_avg13 < mov_avg21;
cross_above.setpaintingstrategy(paintingstrategy.boolean_arrow_up);
cross_above.setdefaultcolor(color.cyan);

plot cross_below = mov_avg8 crosses below mov_avg21 and mov_avg13 > mov_avg21;
cross_below.setpaintingstrategy(paintingstrategy.boolean_arrow_down);
cross_below.setdefaultcolor(color.magenta);``````

that's it, that's the one! thank you again

87k+ Posts
162 Online

## The Market Trading Game Changer

Join 2,500+ subscribers inside the useThinkScript VIP Membership Club
• Exclusive indicators
• Proven strategies & setups
• Private Discord community
• Exclusive members-only content
• 1 full year of unlimited support

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?