♥ 0 |
Can you please provide guidance for thinkorswim platform on how to write a stock scanner… which are within positive or negative 5% of the 20 day median value of the stock in the last 20 days? Thank you. Example.. Median of stock – 100. Stock is oscillating between 95 to 105.. Filter all stocks that pass this criteria.. Thank you.
Marked as spam
|
Private answer
The "median" price is defined as the midpoint between the high and the low of each candle. We can use any standard moving average to compute this, by simply changing the price input from close to "hl2". There is a previous post that does most of the grunt work for this solution and that post is located here: https://www.hahn-tech.com/ans/alert-when-sma-within-x-percent-of-another-sma/ The following code has been modified to check when the current price is within the specified percent of the 20 period simple moving average of the median price:
Marked as spam
|
Please log in to post questions.