Join useThinkScript to post your question to a community of 21,000+ developers and traders.
How do I get a scan to automatically run? I can only seem to get scans to run manually. Second, how would I tie a scan into an existing watchlist in order to create alert that sends me a notification, like the default price alerts available on the chart?@Rojo Grande You can create a scanner and add it to your watchlist.
Average(close, 20) crosses above Average(close, 200)
@Dixon72 and @scottrades I have the following on several timeframes in my Watchlist.@BenTen When I change it to 1 or 2, then everything that hasn't had a crossover since the last 1 or 2 days is orange. Would be nice to have a watchlist that reports the current MA status regardless of the lookback. This way the higher timeframes are green (for example) and you're just waiting for the lower timeframes to agree with it for entry.
#HINT: This is a custom watchlist column looking for xx% percent above or below moving average line. \n It provides a visual alert with the percent from MA line where you expect price to revert to the mean by reversing to return to the MA line.
## because this is a watchlist column there is no Edit box. therefore def could have been used instead of input. To change type of price and/or type of moving average, click on the word "Inspector" top right of this box and click on the word close or the word AverageType.SIMPLE and the Inspector will show you your other choices.
input price = close;
input length = 20;
input Average_Type = AverageType.SIMPLE;
input percent_from_MA = 1;
## these def or "define a new word to ThinkScript" did not have to be used, but it saved a lot of time and typing later in the code by providing ability to use the new "words" instead of typing the math formula multiple times in different lines later in the code
def Avg = MovingAverage(average_Type, price, length);
def MA_below_price = price > Avg;
def MA_above_price = price < Avg;
def percent_away = if MA_below_price or MA_above_price then (close / avg) - 1 else 0;
def oversold = percent_away * 100 <= percent_from_MA * (-1);
def overbought = percent_away * 100 >= (Percent_from_MA);
### AddLabel needs (1) condition to trigger it to be visible or the word yes if always visible, (2) text to appear in quotes + data to appear in the label, (3) color for the label which can be static color or can be dynamic using if __ then __ else ___
AddLabel(yes, if oversold then " below " + AsPercent(percent_away) else if overbought then " above " + AsPercent(percent_away) else AsPercent(percent_away), color.BLACK);
AssignBackgroundColor(if oversold then color.DARK_ORANGE else if overbought then color.GREEN else color.LIGHT_GRAY);
# end code ------------------
Once created/added to my 'Studies', it is not available to select as a column. I notice that none of my custom scripts are available to me in the list of studies.I have the following on several timeframes in my Watchlist.
From the Menu in my Watchlist, I do not have the option to save the watchlist as a scan. There's only an option to 'Create scan query'.To get the scan to run automatically (every 3 minutes approx) save the watchlist as a scan, found in menu on upper right.
Further info is in the Education Tab in ThinkorSwim.
It's possible I have the terminology for aggregation wrong, e.g. if I set aggregation to D would I not be scanning for all instances over the past day?On a 2 minute aggregation I was unable to obtain any results on the S&P 500 so you may have to vary your scan parameters
Have you had your free tour? Write down 5-10 questions that you want an answer to and during the tour you can ask them.It's possible I have the terminology for aggregation wrong, e.g. if I set aggregation to D would I not be scanning for all instances over the past day?
The TOS manual nor TOS Education have a definition of aggregation. The 'Manual' actually says nothing about aggregation and TOS Education states... "Aggregation period constants define a specific aggregation period for your studies and strategies. The period length varies from one minute to option expiration". I have read several of our Tutorials, such as 'How to use the TOS Scanner', which are all great, but there was no definition. in the tutorial I cited, it indicates to set the aggregation period, but does not actually tell me how that affects the scanner. I'm just speculating here, but maybe a yes or no to my question would suffice. Thanks.Have you had your free tour? Write down 5-10 questions that you want an answer to and during the tour you can ask them.
Otherwise, all questions can be answered in the TOS manual or in our Tutorial sections.
Start a new thread and receive assistance from our community.
useThinkScript is the #1 community of stock market investors using indicators and other tools to power their trading strategies. Traders of all skill levels use our forums to learn about scripting and indicators, help each other, and discover new ways to gain an edge in the markets.
We get it. Our forum can be intimidating, if not overwhelming. With thousands of topics, tens of thousands of posts, our community has created an incredibly deep knowledge base for stock traders. No one can ever exhaust every resource provided on our site.
If you are new, or just looking for guidance, here are some helpful links to get you started.