New Members: Be sure to confirm your email address by clicking on the link that was sent to your email inbox. You will not be able to post messages until you click that link.
Need help with CHART, Gap Scan, please!
Hi,
I'm trying to create a scan that finds a stock that gap up 6 days ago over 10% from the previous day. Then essentially traded within a 3% range of that 6th day high day for the next 6 days. So basically looks for a tight 6 day flag from a previous gap over
10%. Also, can you please help include the criteria to show the stock above it's 9 ema
type = stock]
and
[country = us]
and
[6 day's ago low > 7 day's ago high * 1.10]
and
[3 days ago high < 4 days ago high * 1.03]
and
[daily volume > 400000]
Answers
I'm guessing you mean by 3% range, not more than 1.5 % above and not less than 1.5 % below (.015+.015 = .03).
So the minimum (lowest) six day low must be greater than the 6 days ago high * .985 (1-.015)
and the maximum (highest) six day high must less than the 6 days ago high *1.015
Use the min() function to find the lowest low in the last six days, and the max() function to get the highest six day high.
If you get stuck, post what you tried.
[SMA(20, close) > 15]
Please advise.
Thanks
But I'd appreciate help with minimum/maximum.
So like you stated, yes not more than 1.5% higher and 1.5% lower. Can you please help me to edit this? I want to be able to create a flag type of scan. So the stock gapped up 6 days ago and closed 10% higher and then traded within a narrow range for 3 days (or I can easily edit days for 4,5,6 etc)....
[type = stock]
and
[country = us]
and
[6 day's ago low > 7 day's ago high * 1.10]
and
[3 days ago high < 4 days ago high * 1.03]
and
[daily volume > 400000]
So the starting point is the gap.
A gap occurs when the low of the second bar is above, or greater than, the high of the preceding bar.
So if we want to know if there was a gap today:
and [low > 1 day ago high]
Next we want to know if today's close is more than 10 % above yesterday's close.
and [close > 1 day ago close * 1.10]
Now you want to adjust those two statements so they look for the same situation some number of days ago. So I'll let you modify them with the "days ago" edits to get what you want.
Now we want to know if prices have been within a certain range for a certain period of time.
The width of a range is difference between the highest high and lowest low over some number of bars. But we only want situations where the highest high is within some per cent of the close some number of days ago. So we need an expression for the upper limit and an expression for the lower limit.
For your situation, the upper limit of the range has to be:
x days ago close * 1.015
You wanted six days ago, so "x" would be "6".
And the lower limit would be
x days ago close * .985
Now we need to test all the highs since the close against the upper limit.
We need an expression for the highest (max) high over the last "x-1" days. We have to use x-1 because we do NOT want to test the high (or low) from the same bar as the close because a gap up bar normally has a pretty wide range outside the limit we want.
(So for your case, x-1 would be 6-1 = 5)
So in scan engine speak, we would express the high for the last x-1 days as
max(x-1,high)
In the same way, the low would be
min(x-1,low)
So now we have an expression for the highest high in our range
max(x-1,high)
and we have an expression for the high side limit of that range
x days ago close * 1.015
We want the highest high to be less than - "<" -the high side limit, so I will let you build that statement.
// test actual highest high in range against high limit
and [ ... ]
Then you want to do the same thing for the lowest low in the range and the low side limit (min low > low limit).
If you run into trouble, let me know.
Can you please tell me if I wrote the below correctly
[close < .985 *max (5,high)]
I want to find a stock that has closed 1.5% below it's 5 day high. Is that how the above reads?
Thanks
Sam
If you want a range, say less than 1.5 but not more than 2 % below, you need another line
// begin scan
// define stocks to look at
[group is sp500]
// find close between 1.5 and 2 percent below 5 day high
and [close < .985 *max (5,high)]
and [close > .98 * max(5, high)]
// end scan