♥ 0 |
Hi Pete. I have visited your forum and looked at the questions about the stock scanner. One of the question raised was the custom study of 20EMA crossing 50SMA and also the Scanning SMA conditions that stay true. I am looking for a study filter (without the wizard) in TOS and plot me the list of stocks that has 20SMA above 50SMA for say, 90 bars. I would love to see 20SMA stay above 50bars within 90 bars and no single day within 90 bars that 20SMA fall below 50SMA. Must appreciated if you can give me some hints. Thank you.
Marked as spam
|
Private answer
The simplest way to solve this is to use the Condition Wizard. However the request specifically stated "without the wizard". So I will provide both. Custom Code Solution:For the custom code solution the key is to create a variable for the opposite condition. Then check the desired number of previous bars and make sure the unwanted condition has NOT been true for any of those previous bars.
In this case, the variable named "conditionToAvoid" is the 20 period SMA being below the 50 SMA. The final line of code creates the scan signal. The signal is true only if the "conditionToAvoid" has not been true at any point within the set number of bars. Condition Wizard Solution:We absolutely can build this scan without writing a single line of code. We can add a new condition group to the scan called "None of the following", add a new Study Filter to that group. Then build the condition using nothing more than your computer's mouse/trackpad. Screenshots below shows the basic steps as well as the end result. The following video demonstrates how to use the Condition Wizard for custom scans: https://www.hahn-tech.com/thinkorswim-condition-wizard/ And this video shows you everything you ever wanted to know about building custom scans on Thinkorswim: https://www.hahn-tech.com/thinkorswim-scans-beginner-to-advanced/
Marked as spam
|
Please log in to post questions.