Hey ThinkScripters! Been a long time since I have been on the forum so I figured I should come back with some fruit for the group. The following is designed to be used as a scan and is mostly explained in the title:
I recommend setting a price for your stock to be at least $10. In my usage I have it set up for $30 but obviously that is a preference
The Parameters are as follows (the paramaters are hard coded but can be easily adjusted by you:
GradualIncrease - We look for continuously increasing SMA to indicate an uptrend
LowVolatility = Used to ensure that the trend has been gradually increasing and not choppy
weeklyReturn = Used to ensure that our stock is returning at least 1% a wee
I recommend setting a price for your stock to be at least $10. In my usage I have it set up for $30 but obviously that is a preference
The Parameters are as follows (the paramaters are hard coded but can be easily adjusted by you:
GradualIncrease - We look for continuously increasing SMA to indicate an uptrend
LowVolatility = Used to ensure that the trend has been gradually increasing and not choppy
weeklyReturn = Used to ensure that our stock is returning at least 1% a wee
Code:
# Calculate the Simple Moving Average (SMA)
def sma = Average(close, 20);
# Check for gradual increase
def GradualIncrease = sma > sma[5] and sma[5] > sma[10] and sma[10] > sma[15] and sma[15] > sma[20];
# Calculate the daily returns
def dailyReturns = close / close[1] - 1;
# Calculate the standard deviation of the daily returns
def stdev = StDev(dailyReturns, 60);
# Check if the standard deviation is below 0.02
def LowVolatility = stdev < 0.02;
# Define the closing price 5 days ago
def close5DaysAgo = close[5];
# Calculate the weekly return
def weeklyReturn = (close - close5DaysAgo) / close5DaysAgo;
# Calculate the average weekly return over the past 60 trading days
def avgWeeklyReturn = Average(weeklyReturn, 20);
# Check if the average weekly return is at least 1%
def HighAvgWeeklyReturn = avgWeeklyReturn >= 0.01;
# Combine all the conditions into one final plot
plot Scan = GradualIncrease and LowVolatility and HighAvgWeeklyReturn;