Distance of 1 ATR or more between two moving AVGs


Category:
0
0

Hi Pete, I’d like to scan for stocks where the 34ema is at least one ATR above the 55ema. Thank you!

Marked as spam
Posted by (Questions: 1, Answers: 0)
Asked on May 30, 2021 9:44 pm
78 views
1
Private answer

Since you are requesting a custom scan solution I have moved your post out of the "Watch Lists" topic and into the "Stock Scanners" topic.

The following code will produce the results you have requested:

input atrMuliple = 1.0;
input maLengthOne = 34;
input maTypeOne = AverageType.EXPONENTIAL;
input maPriceOne = close;
input maLengthTwo = 55;
input maTypeTwo = AverageType.EXPONENTIAL;
input maPriceTwo = close;
def atrValue = ATR().ATR;
def maOne = MovingAverage(maTypeOne, maPriceOne, maLengthOne);
def maTwo = MovingAverage(maTypeTwo, maPriceTwo, maLengthTwo);
plot scan = maOne > maTwo and maOne - maTwo > atrValue * atrMuliple;

I have included user inputs to adjust the multiple applied to the ATR as well as inputs to adjust all elements of the two moving averages.

Marked as spam
Posted by (Questions: 37, Answers: 4118)
Answered on May 31, 2021 10:32 am