Plot a Dot or Price Level at the point of MA Crossover


Category:
0
0

Hello Hanh-Tech Community,

In TOS, there is a standard MovingAverageCrossover study. How do I have TOS automatically plot a Dot or even a Price Level at the point where the 9 EMA crosses above or Below the 21 EMA? The default signals plots on the candle itself but I would like it to plot at the exact point of crossover, is this possible?

Marked as spam
Posted by (Questions: 1, Answers: 1)
Asked on September 30, 2019 5:38 am
147 views
1
Private answer

I updated the title of you question to remove words that were not needed to explain the context of your question. Terms like "TOS" and "How too" or not required when posting in a Q&A forum focused on how to do things in Thinkorswim.

I also moved your question out of the Strategies topic and into the Chart Studies topic.

The code from the built-in study that you referenced in your question is shown below. The code has been modified to change the plot types and size as well as relocate them to the moving average instead of the high or low of the candle. I also decided to set the averages to plot. The original code does not plot the moving averages.

input price = close;
input length1 = 15;
input length2 = 30;
input averageType1 = AverageType.Simple;
input averageType2 = AverageType.Simple;
plot avg1 = MovingAverage(averageType1, price, length1);
plot avg2 = MovingAverage(averageType2, price, length2);
plot signal = if crosses(avg1, avg2) then avg1 else Double.NaN;
signal.DefineColor("Above", Color.YELLOW);
signal.DefineColor("Below", Color.MAGENTA);
signal.AssignValueColor(if avg1 > avg2 then signal.color("Above") else signal.color("Below"));
signal.SetPaintingStrategy(PaintingStrategy.POINTS);
signal.SetLineWeight(5);

Marked as spam
Posted by (Questions: 37, Answers: 4118)
Answered on September 30, 2019 7:26 am
0
Thank you so much Pete! I'm so lucky to have found your forum. Have a fantastic rest of your week.
( at September 30, 2019 6:18 pm)