Doing a Custom Scan using Lower_MarketForecast Thinkscript


Category:
0
0

I followed your video “Thinkorswim Custom Scan Stochastic MACD” to run a Custom Scan on your Lower_MarketForecast indicator. The Lower_MarketForecast indicator came from your video “TDA thinkMoney Summer 2015”. But I could not get the Custom Scan to work using your Lower_MarketForecast thinkscript. In your video “Thinkorswim Custom Scan Stochastic MACD” it said to change “Data” to “Scan” but with Lower_MarketForecast there are many “Plot” steps in the script. Is it even possible to do this? Thank you.

Marked as spam
Posted by (Questions: 2, Answers: 0)
Asked on June 6, 2017 3:06 pm
2240 views
0
Private answer

Yes this is certainly possible. Just takes a few minutes once you get the hang of this. Before we get into the details let’s provide our viewers with direct links to the videos you listed:

TOS Scan Stochastic MACD: https://www.hahn-tech.com/thinkorswim-custom-scan-stochastic-macd/

TDA thinkMoney Summer 2015: https://www.hahn-tech.com/tda-thinkmoney-summer-2015/

If you have watched many of my videos on custom scans you will notice one of the most important rules is that the scan engine can accept only a single plot statement. Many indicators come with multiple plots. So the process involves turning all the existing plot statements to def statements. This preserves the computed values of the plots without plotting them. Then you have to remove any style statements that were tied to those plots. The Q&A forum is littered with examples of how to do this. Here is one I would recommend: https://www.hahn-tech.com/ans/how-to-turn-the-high-low-study-2-into-a-scan-query/

Here is the code that results when I convert the Lower_MarketForecast study into a scan:

input overBought = 80;
input overSold = 20;
input lookBack = 4;
input plotLevelForBullish = 20;
input plotLevelForBearish = 80;
def shortMF = MarketForecast().Momentum;
def midMF = MarketForecast().NearTerm;
def longMF = MarketForecast().Intermediate;
def bearishCluster = highest(shortMF[1], lookBack) >= overBought and highest(midMF[1], lookBack) >= overBought and highest(longMF[1], lookBack) >= overBought;
def bullishCluster = lowest(shortMF[1], lookBack) <= overSold and lowest(midMF[1], lookBack) <= overSold and lowest(longMF[1], lookBack) <= overSold;
def bearishLevel = overBought;
def bullishLevel = overSold;
def bearClusterSignal;
def bullClusterSignal;
bearClusterSignal = if bearishCluster then 1 else 0;
bullClusterSignal = if bullishCluster then 1 else 0;
#plot scan = bearClusterSignal;
plot scan = bullClusterSignal;

Marked as spam
Posted by (Questions: 37, Answers: 4118)
Answered on June 6, 2017 3:45 pm