Average daily % Change


Category:
0
0

Hello can you help me with the script for watchlist that scan stock that is greater than average daily percentage change of 3 month period. and a script for custom column that shows  how much is the average daily percentage move of last 3 month.

 

Thanks

 

Marked as spam
Posted by (Questions: 12, Answers: 5)
Asked on May 19, 2021 9:31 am
128 views
0
Private answer

Here is the code to display the value as specified:

input length = 63;
def percentChange = 100 * (close / close[1] - 1);
def averageChange = Average(percentChange, length);
plot data = averageChange;

And the code to perform the scan is exactly the same with just one change and one new line added to the code above:

input length = 63;
def percentChange = 100 * (close / close[1] - 1);
def averageChange = Average(percentChange, length);
plot scan = percentChange > averageChange;

Both the custom watchlist column as well as the Study Filter of the scan will be set to daily time frame. There is a user input for length which is set to a value of 63 be default. (There are 21 trading days per month on average).

Marked as spam
Posted by (Questions: 37, Answers: 4118)
Answered on May 19, 2021 11:50 am
0
It says invalid statement for both
( at May 19, 2021 1:17 pm)
0
Sorry about that. I was in a hurry and didn't test the code for errors before posting my solution. I have updated the code in my answer and confirmed that it works without errors.
( at May 19, 2021 1:33 pm)