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.
Options

Is there a way for a scan to capture this type of retesting?



Hi there,

I'm trying to find a way to capture when a stock has broken out of a fairly flat trend and then gone back to those same levels as shown above. Is there a way to scan for that moment when it goes back down to those levels it broke out of?

Thanks!

I think I've sort done captured parts of this through this code:

and [daily close > 5]

and [[min(20, Fast Stoch %K(20, 1)) < 20]
and [1 day ago Upper Price Chan(40) = 30 days ago Upper Price Chan(40)]
and [close x Upper Price Chan(40)]]

or [[min(20, 1 day ago Fast Stoch %K(20, 1)) < 20]
and [2 days ago Upper Price Chan(40) = 31 days ago Upper Price Chan(40)]
and [1 day ago close x 1 day ago Upper Price Chan(40)]]

or [[min(20, 2 days ago Fast Stoch %K(20, 1)) < 20]
and [3 days ago Upper Price Chan(40) = 32 days ago Upper Price Chan(40)]
and [2 day ago close x 2 days ago Upper Price Chan(40)]]

or [[min(20, 3 days ago Fast Stoch %K(20, 1)) < 20]
and [4 days ago Upper Price Chan(40) = 33 days ago Upper Price Chan(40)]
and [3 day ago close x 3 days ago Upper Price Chan(40)]]

or [[min(20, 4 day ago Fast Stoch %K(20, 1)) < 20]
and [5 days ago Upper Price Chan(40) = 34 days ago Upper Price Chan(40)]
and [4 day ago close x 4 day ago Upper Price Chan(40)]]

or [[min(20, 5 day ago Fast Stoch %K(20, 1)) < 20]
and [6 days ago Upper Price Chan(40) = 35 days ago Upper Price Chan(40)]
and [5 day ago close x 5 day ago Upper Price Chan(40)]]

Comments

  • Options
    I didn't run your code, so I can't say whether it works.

    But, I think I would also try another approach using mainly price channels. So,

    - test for a generally rising price trend over some period of time by testing for an upper channel of some length today greater than the same upper channel some number of days or weeks ago, and also do the same for the lower channel.

    - then test for the flat area by testing for that upper channel some number of days/weeks ago EQUAL to the same upper channel some number of days/weeks before that - so maybe 60 days ago = 90 days ago - that would give you a flat upper channel about 30 days long - which may or may not be a good length.

    - finally, test for a recent low (maybe min(20, low)) less than the flat area of the price channel - maybe less than say, 75 days ago upper price channel - something in the middle of the flat area of the price channel.


    You will have to play around with the parameters for the length of the channels - 60? 120, 180? - as well as the look back periods and the length of the flat area. The upper and lower channel parameters should be wider than the flat area you expect to find - so if the flat area is say 60 bars, the channel length should be comfortably more than 60 - may 75 or 90 - so the channel maintains its value (stays equal) over the length of the flat area.

    Keep in mind this set of conditions may not re-occur very often - it may just be an artifact of the recent market - in different markets, the length of the flat area may be considerably longer or shorter, so your scan may not capture similar patterns in the future because they last longer or end earlier.

Sign In or Register to comment.