Adding Arrows and Alerts to AroonIndicator (not the AroonOscillator)

therecluse

New member
I would like to add both an arrow and an alert to the standard AroonIndicator (not the AroonOscillator) that comes in Think or Swim. I only need it to go off when either the up or down hits positive oversold100%. I don't always watch the chart series that this would go on, so I would like an alert/arrow to warn me when this event happens so I can start to look for my crossovers.

Any help is appreciated, thank you.
Ruby:
#
# TD Ameritrade IP Company, Inc. (c) 2007-2022
#

declare lower;

input length = 25;

Assert(length > 0, "'length' must be positive: " + length);

plot Up = (length - 1 - GetMaxValueOffset(high, length)) * 100.0 / (length - 1);
plot Down = (length - 1 - GetMinValueOffset(low, length)) * 100.0 / (length - 1);
plot OverBought = 70;
plot OverSold = 30;

Up.SetDefaultColor(GetColor(1));
Down.SetDefaultColor(GetColor(5));
OverBought.SetDefaultColor(GetColor(8));
OverSold.SetDefaultColor(GetColor(8));
 
Last edited by a moderator:
Solution
Just in case anyone might want to know, after looking at the basic coding resources on this forum, I managed to piece together what I needed to get the results I wanted. I'm posting the results here as a conclusion to the question. Thanks again to the forum members and access to the resources that helped get this resolved. ;)

# AroonIndicator
# TD Ameritrade IP Company, Inc. (c) 2007-2022

declare lower;

input length = 25;

Assert(length > 0, "'length' must be positive: " + length);

plot Up = (length - 1 - GetMaxValueOffset(high, length)) * 100.0 / (length - 1);
plot Down = (length - 1 - GetMinValueOffset(low, length)) * 100.0 / (length - 1);
plot OverBought = 70;
plot OverSold = 30;

Up.SetDefaultColor(GetColor(1))...
I would like to add both an arrow and an alert to the standard AroonIndicator (not the AroonOscillator) that comes in Think or Swim. I only need it to go off when either the up or down hits positive oversold100%. I don't always watch the chart series that this would go on, so I would like an alert/arrow to warn me when this event happens so I can start to look for my crossovers.

Any help is appreciated, thank you.
Ruby:
#
# TD Ameritrade IP Company, Inc. (c) 2007-2022
#

declare lower;

input length = 25;

Assert(length > 0, "'length' must be positive: " + length);

plot Up = (length - 1 - GetMaxValueOffset(high, length)) * 100.0 / (length - 1);
plot Down = (length - 1 - GetMinValueOffset(low, length)) * 100.0 / (length - 1);
plot OverBought = 70;
plot OverSold = 30;

Up.SetDefaultColor(GetColor(1));
Down.SetDefaultColor(GetColor(5));
OverBought.SetDefaultColor(GetColor(8));
OverSold.SetDefaultColor(GetColor(8));


i added an input to pick the minimum trigger level
input min_trigger_level = 99.9;

this draws arrows in the middle of the aroon chart space (easy to see)
an alert will sound when up or down is > the set level.
. a higher pitch sound for up, ding.
. a lower sound for down, bell.


Code:
# aroon_add_arrows_01

#https://usethinkscript.com/threads/adding-arrows-and-alerts-to-aroonindicator-not-the-aroonoscillator.14220/
#Adding Arrows and Alerts to AroonIndicator (not the AroonOscillator)

# AroonIndicator
# TD Ameritrade IP Company, Inc. (c) 2007-2022

declare lower;

input length = 25;

Assert(length > 0, "'length' must be positive: " + length);

plot Up = (length - 1 - GetMaxValueOffset(high, length)) * 100.0 / (length - 1);
plot Down = (length - 1 - GetMinValueOffset(low, length)) * 100.0 / (length - 1);
plot OverBought = 70;
plot OverSold = 30;

Up.SetDefaultColor(GetColor(1));
Down.SetDefaultColor(GetColor(5));
OverBought.SetDefaultColor(GetColor(8));
OverSold.SetDefaultColor(GetColor(8));

#-----------------

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

input min_trigger_level = 99.9;

def upx = (up >= min_trigger_level);
def downx = (down >= min_trigger_level);

plot zup = if upx then 60 else na;
zup.SetPaintingStrategy(PaintingStrategy.ARROW_UP);
zup.SetDefaultColor(Color.green);
zup.setlineweight(4);
zup.hidebubble();

plot zdown = if downx then 40 else na;
zdown.SetPaintingStrategy(PaintingStrategy.ARROW_DOWN);
zdown.SetDefaultColor(Color.red);
zdown.setlineweight(4);
zdown.hidebubble();

alert(upx, "up" ,alert.BAR, sound.DING);
alert(downx, "down" ,alert.BAR, sound.bell);
#

iATswc5.jpg
 

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

Thank you so much!! I will plug this in and see how it works.

I'm trying to put together a strategy but hate watching the market for hours just to see if the conditions are right. I usually wind up neglecting the work that needs to be done, or the market: either/or, lol. At least this way I will get notifications.

Again, I really appreciate this.
 
Thank you so much!! I will plug this in and see how it works.

I'm trying to put together a strategy but hate watching the market for hours just to see if the conditions are right. I usually wind up neglecting the work that needs to be done, or the market: either/or, lol. At least this way I will get notifications.

Again, I really appreciate this.
After playing with this for a week, I was looking to make a few tweeks...if I may so kindly ask. Having observed the times the arrows and alerts go off, I was wondering if you could create an "if/then" criteria to minimize the range of arrows.

First I will lay out the premise behind the purpose. I am playing options and looking for the best times to open and close positions. With the code you wrote for me (thank you again), I wait for either the "bell" or the "ding" to look for entry signals; then I listen for the next corresponding - opposite - alert to tell me when to close. Coupling this with a HMA crossover strategy, it serves quite well. However, by setting an "if/then" criteria, I should be able to greatly reduce the amount of arrows and alerts, freeing up some more time.

I do not use the 70/30 lines on the Aroon, so I have shut them off. I find the best number is approximately 50%. My observations have shown me that nothing major takes place unless either (or even both) "up" and/or "down" lines come near (or cross over) the 50th percentile, as represented by the yellow box in the picture. My thought was that, if either the "up" line or the "down" line cross through and/or into a boxed ranged - between 48% - 52% wide (represented by the skinny, light grey, box in the picture) - then the next time either line meet the 99.9% an alert and arrow would be set on the indicator. A previous "candle count" time period would probably need to be set, otherwise the arrows would always go off anyway, and it would probably be better if it was adjustable.

If this could be done, I would - once again - be very grateful to your expertise and in freeing up some more of my time.

Thank You.

https://www.amazon.com/photos/shared/5lFNNSobSa2u0LR4QHRDLg.tyJ8R-P_tbL-y86gZbB3g0

I don't have a Photobucket account anymore, so I'm sharing this picture through an Amazon account. Sorry for the poor resolution, lol.

Something else I did notice that may make the job easier, and a shade more accurate, is that when both the up and down lines are at both ends of the spectrum (one is at 100% while the other is at 0%); then the arrow/alert seems to be at it's topmost point. That seems easier to accomplish to me, but then again I don't know coding, lol.
 
Last edited by a moderator:
Ahh, sorry for the long response time..I got busy with a few things.

@halcyonguy

After looking over what I posted...yeah...a bit winded and confusing as I laid down two different ideas.

The arrows and alerts I asked about, the first indicator, you put together, was exactly what I asked for.

In it I asked that only when the line exceeded 100% that a plot point and alert mark and sound.

What I soon discovered is that I should have had you do the same for the bottom also.
In other words: If either the up (or down) line exceeds 99.9% AND the opposite line reaches 0%, at the exact same time, then plot a point and make an alert.

I have found that when both lines strike these points at the same time, the market usually does a reversal at that point.

For example, in the included picture we see that when the Aroon points are at complete opposite sides of the spectrum - at the exact same time - a buy/sell condition is met. In this case the red arrow a "sell" and the green arrow a "buy". The lines do not usually meet up until the market is ready to switch. This is, however, chart time specific and can be adjusted by raising or lowering the value of the Aroon itself. In this case I have it set at 24 instead of the standard 25, but it is further adjustable depending on the timeframe of the chart it sits on. This greatly reduces the amount of noise on the chart, both in terms of alerts and arrows, as well as creating better timing for market entries and exits.

It seemed fairly simple to create, but like was mentioned, my droning and switched thought process probably didn't make for a coherent relay of wants and needs. I apologize again.

 
Last edited by a moderator:
Just in case anyone might want to know, after looking at the basic coding resources on this forum, I managed to piece together what I needed to get the results I wanted. I'm posting the results here as a conclusion to the question. Thanks again to the forum members and access to the resources that helped get this resolved. ;)

# AroonIndicator
# TD Ameritrade IP Company, Inc. (c) 2007-2022

declare lower;

input length = 25;

Assert(length > 0, "'length' must be positive: " + length);

plot Up = (length - 1 - GetMaxValueOffset(high, length)) * 100.0 / (length - 1);
plot Down = (length - 1 - GetMinValueOffset(low, length)) * 100.0 / (length - 1);
plot OverBought = 70;
plot OverSold = 30;

Up.SetDefaultColor(GetColor(1));
Down.SetDefaultColor(GetColor(5));
OverBought.SetDefaultColor(GetColor(8));
OverSold.SetDefaultColor(GetColor(8));

#-----------------

def na = double.nan;

def upx = (up == 100);
def downx = (down == 0);
def upy = (up == 0);
def downy = (down == 100);

plot zup = if upx AND downx then 60 else na;
zup.SetPaintingStrategy(PaintingStrategy.ARROW_UP);
zup.SetDefaultColor(Color.green);
zup.setlineweight(4);
zup.hidebubble();

plot zdown = if upy AND downy then 40 else na;
zdown.SetPaintingStrategy(PaintingStrategy.ARROW_DOWN);
zdown.SetDefaultColor(Color.red);
zdown.setlineweight(4);
zdown.hidebubble();

alert(upx AND downx, "up" ,alert.BAR, sound.DING);
alert(downy AND upy, "down" ,alert.BAR, sound.bell);
#
 
Solution

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

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