Aroon parallel lines scan


Category:
0
0

Hi Pete,

I have searched the site for any clues for the scan for the below logic, however I could not find it.

Background Overview

A consolidation is usually forming when both Aroon-Up and Aroon-Down move lower in parallel fashion and the distance between the two lines is narrow. This narrow parallel decline indicates that some sort of trading range is forming. The first Aroon indicator (up or down) to break above 50 and hit 100 will trigger the next signal.

Requirement

Can we have a stocks scan for

The first Aroon indicator to break above 50 for which the Aroon-Up and Aroon-Down were parallel with readings below 50 within xx bars?

Hope the chart image (from school.stockcharts.com)  will represent better the specification.

I presume this cannot be achieved through the condition wizard. Your guidance and help will be appreciated as always.

Thanks

Jay

 

Attachments:
Marked as spam
Posted by (Questions: 6, Answers: 7)
Asked on June 29, 2020 2:21 am
81 views
0
Private answer

It's great that you provided a screenshot. However it's always best to provide one that includes current data so we can bring that chart up on our screens and take a look at the details.

I added the Aroon indicator as well as the Aroon Oscillator to a chart and thumbed through a few charts to see if the oscillator somehow captured this challenging pattern in a way that is much easier to code. Screenshot below shows what I found. When the two line are parallel, they oscillator is flat. The closer that flat period is to the zero line the closer those two lines are to one another. So we have two metrics to work with and most of the hard work is down for us.

The code includes user inputs to adjust the key metrics without modifying the code. You will have to plan around with the settings to get the exact signals you are looking for. But the code is checking for a specified number of bars where the oscillator is flat. Then it checks if that flat pattern formed within the ideal range (below zero and above -50). When the oscillator breaks above the zero line the code checks if it was immediately preceded by this flat pattern formation.

Here is the code:

input length = 25;
input barsToBeFlat = 10;
input barsToTrigger = 3;
input flatRangeHigh = 0.0;
input flatRangeLow = -50.0;
Assert(length > 0, "'length' must be positive: " + length);
def aroonUp = reference AroonIndicator(length = length).Up;
def aroonDown = reference AroonIndicator(length = length).Down;
def upDownDiff = aroonUp - aroonDown;
def twoBarDiff = upDownDiff - upDownDiff[1];
def flat = twoBarDiff == 0;
def desiredPattern = Sum(twoBarDiff, barsToBeFlat) == 0 and upDownDiff < flatRangeHigh and upDownDiff > flatRangeLow;
plot scan = Highest(desiredPattern[1], 3) > 0 and upDownDiff > flatRangeHigh;

I recommend you plot this on a lower chart study as shown in the screenshot below. This will help you play around with the settings to get things dialed in exactly as you require. Then you can use those settings for your scans and further tweaks things using the scan results as feedback.

Attachments:
Marked as spam
Posted by (Questions: 37, Answers: 4084)
Answered on June 29, 2020 9:31 am
0
Fantastic, I will play around a bit and let you know the results. Thanks a lot Pete. I will try to get a recent chart for next questions. Best regards, Jay
( at June 29, 2020 9:52 am)