@Dixon72 Sure, just go into the settings and change the lookback period. If your question is has it crossed in the last 30 days, then the lookback would be changed to 30. Hope that helps.@BenTen Is a lookback necessary? Is it possible to just get the status of the latest crossover? Thanks.
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 ------------------
|Thread starter||Similar threads||Forum||Replies||Date|
|D||Convert Ehlers Kalman moving average crossover||Questions||0|
|Simple moving average crossover scan||Questions||1|
|P||Moving average crossover with volume spike?||Questions||0|
|F||Moving Average Crossover Strategy||Questions||2|
|R||Williams AD Indicator with Moving Average Crossover for ThinkorSwim||Indicators||15|