This will probably be pretty easy for someone that understands ToS better than me. Just a newbe here.
I started this with thinkscript code from ToS, however I cannot seem to get it to do exactly what I want.
I am trying to get it to show a red arrow on top pointing down when the 8ema close crosses below the 8ema open.
Then a green arrow on bottom pointing up when the 8ema close crosses above the 8ema open.
Also, if not to much trouble to add the ability to turn on and off the plotting of the ema lines in addition to the signals.
Somehow I ended up with a signal and an arrow. in the plots. I broke the script when I removed one.
I started this with thinkscript code from ToS, however I cannot seem to get it to do exactly what I want.
I am trying to get it to show a red arrow on top pointing down when the 8ema close crosses below the 8ema open.
Then a green arrow on bottom pointing up when the 8ema close crosses above the 8ema open.
Also, if not to much trouble to add the ability to turn on and off the plotting of the ema lines in addition to the signals.
Somehow I ended up with a signal and an arrow. in the plots. I broke the script when I removed one.
Code:
#
# TD Ameritrade IP Company, Inc. (c) 2009-2024
#
#wizard input: length1
#wizard text: -period
#wizard input: averageType1
#wizard text: crosses
#wizard input: crossingType
#wizard input: length2
#wizard text: -period
#wizard input: averageType2
#wizard text: Price:
#wizard input: price
input price1 = Open;
input length1 = 8;
input price2 = close;
input length2 = 8;
input averageType1 = AverageType.Simple;
input averageType2 = AverageType.Simple;
input crossingType = {default above, below};
def avg1 = MovingAverage(averageType1, price1, length1);
def avg2 = MovingAverage(averageType2, price2, length2);
plot signalu = crosses(avg1, avg2, crossingType == CrossingType.above);
plot signald = crosses(avg1, avg2, crossingType == CrossingType.below);
#signalu.DefineColor("Above", GetColor(6));
#signald.DefineColor("Below", GetColor(7));
#signalu.AssignValueColor(if crossingType == CrossingType.above then signalu.color("Above") else signald.color("Below"));
plot ArrowUp = if signald crosses above signalu
then low
else double.nan;
ArrowUP.SetPaintingStrategy(PaintingStrategy.Arrow_UP);
ArrowUP.SetLineWeight(3);
ArrowUP.SetDefaultColor(Color.Green);
plot ArrowDN = if signald crosses below signalu
then high
else double.nan;
ArrowDN.SetPaintingStrategy(PaintingStrategy.Arrow_DOWN);
ArrowDN.SetLineWeight(3);
ArrowDN.SetDefaultColor(Color.Red);