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.

Pullback Scan

Hello, I am writing a script for pullbacks. Seems I am having issues when trying to add the inside day to my scan. I am trying to accomplish 3 days of lower daily lows, or two days of daily lower lows and an inside day. Thanks in advance

[type is stock]
and [country = US]
and [ [exchange is NYSE]
or [exchange is NASDAQ] ]
and [Volume > 500,000]
and [Close > 10]
and [Close > sma(20)]
and [Close > sma(50)]
and [ [Low IS BELOW 1 day ago low]
and [1 day ago Low IS BELOW 2 days ago low]
or [Low IS BELOW 1 day ago low]
and [1 day ago Low IS BELOW 2 days ago low]
and [High IS BELOW 1 day ago High]
and [Low IS ABOVE 1 day ago Low] ]

Comments

  • markdmarkd mod
    edited November 13
    "OR" conditions are tricky.

    See if this re-grouping does it. I've added a pair of brackets around the two lines of the first "or" condition and another pair around the four lines of the second "or" condition.

    P.S. I only checked the brackets, not the logic of each line.


    [type is stock]
    and [country = US]
    and [ [exchange is NYSE]
    or [exchange is NASDAQ] ]
    and [Volume > 500,000]
    and [Close > 10]
    and [Close > sma(20)]
    and [Close > sma(50)]
    and

    [ // begin "or"

    [ // first "or" group

    [Low IS BELOW 1 day ago low]
    and [1 day ago Low IS BELOW 2 days ago low]

    ] // end first or group

    or

    [ // begin second "or" group

    [Low IS BELOW 1 day ago low]
    and [1 day ago Low IS BELOW 2 days ago low]
    and [High IS BELOW 1 day ago High]
    and [Low IS ABOVE 1 day ago Low]

    ] // end second or group

    ] // end "or"
  • Thanks for you response, are you suggesting my script look like this?

    [type is stock]
    and [country = US]
    and [ [exchange is NYSE]
    or [exchange is NASDAQ] ]
    and [Volume > 500,000]
    and [Close > 10]
    and [Close > sma(20)]
    and [Close > sma(50)]
    and
    [[Low IS BELOW 1 day ago low]
    and [1 day ago Low IS BELOW 2 days ago low]]
    or
    [[Low IS BELOW 1 day ago low]
    and [1 day ago Low IS BELOW 2 days ago low]
    and [High IS BELOW 1 day ago High]
    and [Low IS ABOVE 1 day ago Low]]

    I am very new to writing scripts. Thx
  • I do it my way because I think its easier to read.

    If your version has the same placement of brackets, then it's the same.

    The slashes // are comment symbols, meaning the scan engine does not read anything after // on the same line.

    Also, the scan engine allows blank lines - it figures out where the opening and closing brackets are and which goes with which even across multiple lines. So you can space out the scan lines as I did for readability. But everyone is different and your way is fine if it works for you.
  • Thanks, I just copied yours as is and I get the same results. I am working at it; I like your look better, still having trouble getting the right results once I implement the last four lines. All looks good until I add those parameters. Frustrating :)
  • I'd may suggest replacing IS BELOW with a < symbol. Although some things may "pass" syntax checks, the current scan engine may disregard or misinterpret some of the original "common english" allowable terminology.
  • Thanks @lmkwin and @markd I now have a scan functioning the way it was intended. Changing the IS Below/IS Above to <> symbols did the trick. Can't get the time back I wasted trying to figure this out, but considering it education. Thx Again
  • I was going to say "IS BELOW" is not allowed but when I pasted the scan into the workbench it produced no errors. But as @lmkwin says, there are some quirks sometimes, apparently.
Sign In or Register to comment.