Scan for recent highs
Author: denoving
Creation Date: 9/13/2012 11:24 AM
profile picture

denoving

#1
I'd like to to have a scanner script that scans the preceding 20 day bars closing price, and if the price within the trailing 20 days was more than 4% greater than the most recent closing price, then I'd like to buy at the market in Bar + 1. It must also check the linear regression line point 20 days back and compare that price to the current price. The most recent closing price must be greater than the closing price Linear regression line point 20 day bars back.

regards,
Dan
profile picture

Eugene

#2
QUOTE:
if the price within the trailing 20 days was more than 4% greater than the most recent closing price,

Could you expand, clarify, or exemplify this?
profile picture

denoving

#3
Sure, I'd be glad to do that.

For example, If the price was 10 dollars per share at the closing price today, I'd look
back at the closing prices for the last 20 day bars and if at any time during
those 20 day bars the highest price was more than $10.40, then I'd set a flag. Then
if I checked the 90 day closing LIN REG price 20 days ago, and if the Lin reg price
20 days ago was greater than $10.40, and if the flag was set, then Issue a buyatmarket.

regards,
Dan
profile picture

Eugene

#4
Here you go Dan:
CODE:
Please log in to see this code.
profile picture

denoving

#5
Thanks Eugene!

That seems to do what I wanted.

regards,
Dan
This website uses cookies to improve your experience. We'll assume you're ok with that, but you can opt-out if you wish (Read more).