This is a basic start for the scans. We can build from here.
When you save the scan (with whatever name you give it) you can select it from the studies then change the inputs to your preference (length or average type).
https://tickertape.tdameritrade.com...average-thinkscript-stock-momentum-tool-15190
When you save the scan (with whatever name you give it) you can select it from the studies then change the inputs to your preference (length or average type).
https://tickertape.tdameritrade.com...average-thinkscript-stock-momentum-tool-15190
Ruby:
## Started on 2021.09.23
## MA Slope SCAN
##
##
## CREDITS
## Orignal source https://tickertape.tdameritrade.com/trading/cool-scripts-create-moving-average-thinkscript-stock-momentum-tool-15190
##
##
## Removing the header Credit credits and description is not permitted, any modification needs to be shared.
##
## V 1.0 : @cos251 - SCAN version of MA Slope
## :
input length = 20;
input price = close;
input averageType = AverageType.SIMPLE;
def avg = MovingAverage(averageType,price,length);
def height = avg - avg[1];
plot "Angle, deg" = Atan(height/length) * 180 / Double.Pi;
plot crossPositive = "Angle, deg" > 0 and "Angle, deg"[1] < 0;
plot crossNegative = "Angle, deg" < 0 and "Angle, deg"[1] > 0;
- UPDATED WITH AN ADDITIONAL EXAMPLE SCAN
Ruby:
## Started on 2021.09.23
## MA Slope SCAN
##
##
## CREDITS
## Orignal source https://tickertape.tdameritrade.com/trading/cool-scripts-create-moving-average-thinkscript-stock-momentum-tool-15190
##
##
## Removing the header Credit credits and description is not permitted, any modification needs to be shared.
##
## V 1.0 : @cos251 - SCAN version of MA Slope
## :
input length = 20;
input price = close;
input averageType = AverageType.SIMPLE;
def avg = MovingAverage(averageType,price,length);
def height = avg - avg[1];
plot "Angle, deg" = Atan(height/length) * 180 / Double.Pi;
plot crossPositive = "Angle, deg" > 0 and "Angle, deg"[1] < 0;
plot crossNegative = "Angle, deg" < 0 and "Angle, deg"[1] > 0;
# --- Example Near Zero but not greater
def approachZero = "Angle, deg" > "Angle, deg"[1] and "Angle, deg"[1] > "Angle, deg"[2] and "Angle, deg" > -.1 and "Angle, deg" < 0;
plot NearZeroUp = if approachZero then 1 else Double.NaN;
Last edited by a moderator: