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);
 

Pensar

Well-known member
VIP
Lifetime
@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
 

BenTen

Administrative
Staff member
Staff
VIP
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);
 

Similar threads

Top