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.

Count

I would like to scan the stocks that show a closing price greater than the opening price in the last n bars.
For example: closing price greater than the opening price 7 times in the last 8 bars.
I tried with this: [Count Up(8, close > open) > 6] but it seems it doesn't work.
Anyone can help?
Thanks in advance.

Comments

  • Count Up, Count Down, Streak Up and Streak Down are specialized functions that do only what they were designed to do. Unfortunately, the user cannot customize them further.

    So, these functions will take any single valid existing value (like high, low, close, open, RSI(14), etc.), but they are not designed (meaning, there is no code to handle) to evaluate expressions with an operator like "close > open".
  • this will give you 8 up out of 8. Then you would just need to add in the other options as additional blocks

    and [
    [0 days ago Close > 0 days ago Open] //1. today
    and [1 days ago Close > 1 days ago Open] //2. yesterday
    and [2 days ago Close > 2 days ago Open] //3. day before yesterday
    and [3 days ago Close > 3 days ago Open] //4. day before that
    and [4 days ago Close > 4 days ago Open] //5. 2 days before the day before yesterday
    and [5 days ago Close > 5 days ago Open] // 6. 1 week ago from today
    and [6 days ago Close > 6 days ago Open] // 7. 1 week and 1 day ago
    and [7 days ago Close > 7 days ago Open] // 8. 8 trading days before today
    ]
    or
    //additional blocks of scenarios
    [
    [ 1,2,3,4,5,6,7 up and 8 down] // 7 in a row up last one down for > 6 of 8 (which is 7 of 8)
    [
    or
    [
    [ 1,2,3,4,5,6,8 up and 7down] // 7th day down, the rest up
    ]
    or
    [
    1,2,3,4,5,7,8 up and 6 down]
    ]
    or......

    A bit long of a scan but not terrible, if that's what you are looking for. >6 of 8 is 7 of 8. If you were looking for >=6 of 8 then it would just be more blocks for the additional scenarios. 1,2,3,4,5,6 up and 7,8 down. 1,2,3,4,5,7 up and 6,8 down. etc....
Sign In or Register to comment.