MACD Strategy into scan


Category:
0
0

I’ve been searching your forum and I know you’ve done this scan but I just can’t find it. MACDStrategy in TOS on a single time frame turned into a scan. I’ve tried converting this myself but I’m just missing something can you help?

Thanks

Anthony Tremarco

Marked as spam
Posted by (Questions: 6, Answers: 3)
Asked on December 26, 2021 10:34 am
249 views
0
Private answer

You cannot replicate the signals from a chart strategy in the form of a scan. The strategy does contain signals which are used to plot the theoretical buys and sells. However those signals are generated by the strategy in a way that cannot be perfectly replicated in any scan. You can scan for the raw signals. But they will not always match the theoretical buys and sells you see on the chart.

Here is the code to scan for the raw signals used by the strategy. Subject to the limitations I just described:

input fastLength = 12;
input slowLength = 26;
input macdLength = 9;
input averageType = AverageType.EXPONENTIAL;
def diff = reference MACD(fastLength, slowLength, macdLength, averageType).Diff;
# use this to scan for buy signals
plot scan = diff crosses above 0;
# use this to scan for sell signals
#plot scan = diff crosses below 0;

Marked as spam
Posted by (Questions: 37, Answers: 4118)
Answered on December 28, 2021 6:33 pm
0
Thank you for all of your insight in the videos and posts. For the MACD indicator and scan, what is the most efficient way to put in a different timeframe?
( at January 10, 2022 7:07 pm)
0
The time frame cannot be included within the code or the scan will report an error and cannot be saved. I suggest you check out our master class on Thinkorswim scans to learn how to adjust the time frame for a Study Filter. As well as many other essential details: https://www.hahn-tech.com/thinkorswim-scans-beginner-to-advanced/
( at January 10, 2022 7:13 pm)