Aroon Indicator with Signals for ThinkorSwim

GGC

New member
I was able to insert arrows in the Aroon Oscillator when the oscillator crosses the overbought level (up or down) or the oversold level (up or down). I would like to get some help on position arrows in a lower study. Unfortunately the arrows show up in the upper part of the study window (see code below). Can anyone help me position the arrows near the oscillator line or the overbought/oversold levels?

Code:
declare lower;

input length = 25;

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

def aroonUp = reference AroonIndicator(length = length).Up;
def aroonDown = reference AroonIndicator(length = length).Down;

plot UpDownDiff = aroonUp - aroonDown;
plot OverBought = 50;
plot MiddleLine = 0;
plot OverSold = -50;

UpDownDiff.SetDefaultColor(GetColor(1));
OverBought.SetDefaultColor(GetColor(8));
MiddleLine.SetDefaultColor(GetColor(8));
OverSold.SetDefaultColor(GetColor(8));

plot crossing = crosses(UpDownDiff,OverBought) and UpDownDiff >= OverBought;
crossing.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_UP);
plot ccrossing = crosses(UpDownDiff,OverBought) and UpDownDiff <= OverBought;
ccrossing.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_DOWN);
plot cccrossing = crosses(UpDownDiff,OverSold) and UpDownDiff >= OverSold;
cccrossing.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_UP);
plot ccccrossing = crosses(UpDownDiff,OverSold) and UpDownDiff <= OverSold;
ccccrossing.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_DOWN);
 
@GGC - I believe this code positions the arrows in the appropriate spots - if not, let me know. :)

Code:
#Aroon Oscillator with Crossing Signals
#Aroon Oscillator code by TD Ameritrade IP Company, Inc. (c) 2007-2020
#Added arrows when the AO crosses Oversold and Overbought levels

declare lower;

input length = 25;

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

def aroonUp = reference AroonIndicator(length = length).Up;
def aroonDown = reference AroonIndicator(length = length).Down;

plot UpDownDiff = aroonUp - aroonDown;
plot OverBought = 50;
plot MiddleLine = 0;
plot OverSold = -50;

UpDownDiff.SetDefaultColor(GetColor(1));
OverBought.SetDefaultColor(GetColor(8));
MiddleLine.SetDefaultColor(GetColor(8));
OverSold.SetDefaultColor(GetColor(8));

#arrow signals
plot ArrowUpLow = if UpDownDiff[1] < OverSold and Updowndiff >= OverSold  
               then OverSold else double.nan;
     ArrowUpLow.SetPaintingStrategy(PaintingStrategy.Arrow_Up);
     ArrowUpLow.SetDefaultColor(color.green);
     ArrowUpLow.SetLineWeight(3);

plot ArrowUpHigh = if UpDownDiff[1] < OverBought and Updowndiff >= OverBought  
               then OverBought else double.nan;
     ArrowUpHigh.SetPaintingStrategy(PaintingStrategy.Arrow_Up);
     ArrowUpHigh.SetDefaultColor(color.green);
     ArrowUpHigh.SetLineWeight(3);

plot ArrowDnHigh = if UpDownDiff[1] > OverBought and Updowndiff <= OverBought
               then OverBought else double.nan;
     ArrowDnHigh.SetPaintingStrategy(PaintingStrategy.Arrow_Down);
     ArrowDnHigh.SetDefaultColor(color.red);
     ArrowDnHigh.SetLineWeight(3);

plot ArrowDnLow = if UpDownDiff[1] > OverSold and Updowndiff <= OverSold
               then OverSold else double.nan;
     ArrowDnLow.SetPaintingStrategy(PaintingStrategy.Arrow_Down);
     ArrowDnLow.SetDefaultColor(color.red);
     ArrowDnLow.SetLineWeight(3);

#End of code
 
I wanted to know if it is possible to plot arrows on ThinkorSwim chart to indicate Aroon long/ short crossovers. When Cyan line crosses above Red, it is a long... and same way in reverse.

Code:
#
# TD Ameritrade IP Company, Inc. (c) 2007-2020
#

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 also want to share this here for those who need to scan for Aroon signals.

Scan Aroon Bearish Cross: http://tos.mx/t8JtPh
Scan Aroon Bullish: http://tos.mx/nkfr0F
Scan Aroon Overbought: http://tos.mx/mK9L91
Scan Aroon Oversold: http://tos.mx/NqVhAQ
 
Add this to the bottom of your script:

Code:
def bullish = Up crosses above Down;
def beairsh = Up crosses below Down;

plot U_Arrow = if bullish then 0 else Double.NaN;
U_Arrow.SetDefaultColor(Color.orange);
U_Arrow.SetPaintingStrategy(PaintingStrategy.ARROW_UP);

plot D_Arrow = if beairsh then 100 else Double.NaN;
D_Arrow.SetDefaultColor(Color.red);
D_Arrow.SetPaintingStrategy(PaintingStrategy.ARROW_DOWN);
 
I am having issues with only a part of a code. The original code is for the aroon oscillator. The bottom part of the code is what I need help with, but its pretty general, so if the entire code is needed, please advise and I will post it. I am just trying to steamline and keep simple. In the following two statements:

plot x = if UpDownDiff > UpDownDiff[1] then UpDownDiff else double.nan;

plot y = if UpDownDiff > UpDownDiff[1] then double.nan else UpDownDiff;

What would be the plot if the output was neither x nor y?

I am thinking something like:

Plot normal = (neither x nor y)

But I dont know exactly how to word it so that thinkorswim doesnt give me an error message.

If anyone could help, it would be great;y appreciated!
 
I am having issues with only a part of a code. The original code is for the aroon oscillator. The bottom part of the code is what I need help with, but its pretty general, so if the entire code is needed, please advise and I will post it. I am just trying to steamline and keep simple. In the following two statements:

plot x = if UpDownDiff > UpDownDiff[1] then UpDownDiff else double.nan;

plot y = if UpDownDiff > UpDownDiff[1] then double.nan else UpDownDiff;

What would be the plot if the output was neither x nor y?

I am thinking something like:

Plot normal = (neither x nor y)

But I dont know exactly how to word it so that thinkorswim doesnt give me an error message.

If anyone could help, it would be great;y appreciated!
plot normal = !x and !y ;
 

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