stocks with prices close to 13 EMA scan edit


Category:
0
0

hi! how are you doing? i’d like to scan for stocks whose price is near the 13 EMA. i dont know how to code for EMA. my scan seems to scan for SMA. this is what i got so far:

input price = close;
input length1 = 13;
input displace = 0;
input choice1= 1;

def SMA15 = Average(price[-displace], length1);

def pricecond = price>=sma15*((100 + choice1)/100);

plot scan = pricecond;

 

Marked as spam
Posted by (Questions: 6, Answers: 8)
Asked on February 16, 2017 9:32 pm
604 views
1
Private answer

So the code you have presented would find stocks with a closing price greater than or equal to the 13 period simple moving average plus 1%.

Here is a link to the Thinkorswim language reference describing how to code for the exponential moving average: http://tlc.thinkorswim.com/center/reference/thinkScript/Functions/Tech-Analysis/ExpAverage.html

So you would need to modify this statement: def SMA15 = Average(price[-displace], length1);

As follows:

def SMA15 = ExpAverage(price[-displace], length1);

Don’t forget to up-vote any questions that best solve your question.

Marked as spam
Posted by (Questions: 37, Answers: 4087)
Answered on February 16, 2017 9:44 pm