scan for ElliotOscillator above or below zero consecutive number of bars


Category:
0
0

Using the ElliotOscillator on TOS, I would like to be able to scan for the following conditions:

I wish to be able to input the number of red bars, and have the scan return those tickers that meet the condition, where the number of bars specified are  consecutively red.

For example, if I input 20, I want to return those tickers where there have been 20 red bars in a row.  If I input 50, the scan should return those tickers where there have been 50 red bars in a row.  The scan should work on any timeframe.

RESOLVED
Marked as spam
Posted by (Questions: 1, Answers: 1)
Asked on November 21, 2019 6:50 am
113 views
0
Thank you! Exactly what I wanted.
( at November 21, 2019 5:36 pm)
0
Private answer

I updated the question title so that it describes the context of your request. The title you entered did not. We need to make sure the question titles provide sufficient detail so the rest of our audience is able to locate what they need through search.

Here is your scan:

input shortLength = 5;
input longLength = 35;
input consecutiveBars = 20;
def price = (high + low) / 2;
def elliotOsc = Average(price, shortLength) - Average(price, longLength);
def redHistogram = elliotOsc < 0; def greenHistogram = elliotOsc > 0;
# use this to scan for consecutive green bars
plot scan = Lowest(greenHistogram, consecutiveBars) > 0;
# use this to scan for consecutive red bars
#plot scan = Lowest(redHistogram, consecutiveBars) > 0;

Marked as spam
Posted by (Questions: 37, Answers: 4118)
Answered on November 21, 2019 4:31 pm