Consecutive 5 min bars above 9 EMA


Category:
0
0

Pete, I was looking for a scan that will find stocks with an X number of consecutive 5 Min bars above the 9 EMA.  I attached a screenshot as an example.

Attachments:
Marked as spam
Posted by (Questions: 6, Answers: 17)
Asked on October 23, 2018 7:42 pm
355 views
0

Pete could you show me where I went wrong. I tried to create a scan to pick up consecutive closes below the 9SMA using this scan as a guide. Here is what I have
input consecutiveBars = 5;
input maLength = 9;
input averageType = AverageType.SIMPLE;
def avg = MovingAverage(averageType, close, maLength);
def belowAvg = close < avg; plot scan = Lowest(belowAvg, consecutiveBars) > 0;
 

( at March 14, 2019 6:07 am)
0
Private answer

I so no drawings or comments in your screenshot showing which price pattern you were trying to pick up. All I saw was a chart.

Based on your description, this code should do the trick.

input consecutiveBars = 5;
input maLength = 9;
input averageType = AverageType.EXPONENTIAL;
def avg = MovingAverage(averageType, close, maLength);
def aboveAvg = close > avg;
plot scan = Lowest(aboveAvg, consecutiveBars) > 0;

 

Marked as spam
Posted by (Questions: 37, Answers: 4118)
Answered on October 24, 2018 7:03 am
0

Thank you Pete,  I will test the code out later today.  In the screenshot starting around 11:45 there were 21 consecutive 5 min bars above the 9 EMA so if I wanted to capture in scan when there were 4 (5 min bars) above the EMA I just need to change the last line of code to: 

plot scan = Lowest(aboveAvg, consecutiveBars) > 3;   

Correct?

( at October 24, 2018 8:41 am)
0

No, I provided a user input in the code for that. It’s named “consecutiveBars” and is found in the very first line of the code.

( at October 24, 2018 8:45 am)
0

Pete, I am liking the scan you provided for me. Is it possible to add to the scan the following: Want the current 5 min volume to be greater than the average of the 2 preceding 5 min bars. With this I hope not only to see stock is staying above the 9 EMA but also volume coming in. Thanks again

( at October 26, 2018 11:42 am)
0

Sorry, we really need to have all the specifications declared from the very start. Otherwise the post becomes very messy and difficult for others to follow. You can easily construct your volume test using the condition wizard and add it as a completely separate study filter.

( at October 26, 2018 2:43 pm)