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.

Lowest range from 10 days

Hi
I am looking to run a scan where there have been 10 days of consecutive lows with today, the 10th day the biggest move lower in percentage terms
Thanks

Best Answers

  • markdmarkd mod
    edited October 2015 Answer ✓
    I think the only way to do this is the brute force way -

    and [low < 1 day ago low]
    and [1 day ago low < 2 days ago low]
    and [2 days ago low < 3 days ago low]
    and...
    etc.

    As for biggest percentage move lower, that's a bear (so to speak) -


    and [1 day ago close > close]

    and [ [1 day ago close - close]/1 day ago close > [2 days ago close - 1 day ago close]/2 days ago close ]

    and [2 days ago close > 1 day ago close]

    and [ [1 day ago close - close]/1 day ago close > [3 days ago close - 2 day ago close]/3 days ago close ]

    etc.

    Watch your brackets.

    Not sure how often you are going to get hits with this. The longer and more specific the pattern, the less often it occurs. Also, the subsequent action will not always be the same either. But what the heck, give it a try.
  • gordgord admin
    edited October 2015 Answer ✓
    I agree with Markd, the best way to start coding is using the long brute force method as it allows you to better understand what you are coding for.

    However once you get to know your indicators a little better you can use some tricks.

    If we use the PercentChange function and set the duration for 1 day, then if the %change is less than Zero, the close is lower today than it was yesterday.

    We can also use the Min / Max overtime function to see if the %Change has been less than Zero for multiple days. And also to see if todays %change is is greater (more negative in this case), than previous multiple days.

    [type = Stock]
    and [country is US]
    and [1 day ago Max (5, PctChange (1,close)) < 0]
    and [ PctChange (1,close) < 1 day ago Min (5, PctChange (1,close)) ]

    Note I didn't get any hits when using 10 days so switched to 5 days and did get some hits for verification of the scan. Play around and see what you think.

Answers

  • Yes, thats the way i was going to write it but i thought you might know an easier way. At least i get to practise my coding.
  • markdmarkd mod
    edited October 2015
    @gord Much more elegant, Gord. My coding days are too far behind me... I especially like the last line, but I wonder if you meant to write Max(5, PctChange(1,low) < 0) to capture the condition of consecutive lows (instead of closes) on the third line?
  • Thanks Markd,

    Yes it could be written as lower lows. I wasn't sure if Morgan was looking for lower closes or lower lows, so just made the example for lower closes.
  • Thanks Guys. Appreciate it.
Sign In or Register to comment.