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.

Scan combining the " and " and " or "

Below is part of a larger scan. I am trying to compress the larger scan because I have used all of the allowed characters. Below is the first part of the larger scan and it won't work. I think that it's because I don't know how to properly use brackets while using the "and" and "or"? Probably very confusing but I would like for the first sentence to be the constant and then each of the 4 sentences below to be used separately in conjunction with the first sentence. I think that the "and" at the beginning of the second sentence is where my problem lies?

[Favorites list is 10] and [[[This week's MACD Line(12,26,9) > 0.0] and [This week's MACD Line(12,26,9) > This week's MACD Signal(12,26,9)] and [This week's MACD Line(12,26,9) > Last week's MACD Line(12,26,9)]

and [Today's MACD Line(12,26,9) > 0.0] and [Today's MACD Line(12,26,9) > Today's MACD Signal(12,26,9)] and [Today's MACD Line(12,26,9) > Yesterday's MACD Line(12,26,9)] and [Today's MACD Hist(6,9,0) > Yesterday's MACD Hist(6,9,0)] and [Yesterday's MACD Hist(6,9,0) < 0.0]]

or [[Today's MACD Line(12,26,9) > 0.0] and [Today's MACD Line(12,26,9) < Today's MACD Signal(12,26,9)] and [Today's MACD Hist(12,26,9) > Yesterday's MACD Hist(12,26,9)] and [Today's MACD Hist(6,9,0) > Yesterday's MACD Hist(6,9,0)] and [Yesterday's MACD Hist(6,9,0) < 0.0]]

or [[Today's MACD Line(12,26,9) < 0.0] and [Today's MACD Line(12,26,9) < Today's MACD Signal(12,26,9)] and [Today's MACD Line(12,26,9) > Yesterday's MACD Line(12,26,9)] and [Today's MACD Hist(6,9,0) > Yesterday's MACD Hist(6,9,0)] and [Yesterday's MACD Hist(6,9,0) < 0.0]]

or [[Today's MACD Line(12,26,9) < 0.0] and [Today's MACD Line(12,26,9) > Today's MACD Signal(12,26,9)] and [Today's MACD Line(12,26,9) > Yesterday's MACD Line(12,26,9)] and [Today's MACD Hist(6,9,0) > Yesterday's MACD Hist(6,9,0)] and [Yesterday's MACD Hist(6,9,0) < 0.0]]]

Comments

  • markdmarkd mod
    edited July 2018
    I think you placed your "or" incorrectly.

    The generic format for an or statement with compound conditions would be :


    and

    [ // opening bracket for "or" statement

    [ // alternative 1

    [condition 1]
    [condition 2]
    [ ... ]

    ] // end 1

    or

    [ // alternative 2

    [condition 1]
    [condition 2]
    [...]

    ] // end 2

    or
    ....

    ] // closing bracket for or statement

    Also, you can eliminate a lot of characters by accepting the default format for the daily timeframe, which is no time frame modifier. (e.g. close, vs. today's close)

    Finally, don't be afraid to use white space and plenty of lines. It makes things much clearer if every "and" gets its own line. That also makes it much easier to test for errors by placing "//" in front of the line to block the scan engine from executing it.

    This version of your scan gets 18 hits on the sp500.


    [favorites list is 10 ]

    and [weekly MACD Line(12,26,9) > 0.0]
    and [weekly MACD Line(12,26,9) > weekly MACD Signal(12,26,9)]
    and [weekly MACD Line(12,26,9) > 1 week ago weekly MACD Line(12,26,9)]


    and


    [ // begin or

    [ // alt 1
    [MACD Line(12,26,9) > 0.0]
    and [ MACD Line(12,26,9) > MACD Signal(12,26,9)]
    and [ MACD Line(12,26,9) > 1 day ago MACD Line(12,26,9)]
    and [ MACD Hist(6,9,0) > 1 day ago MACD Hist(6,9,0)]
    and [ 1 day ago MACD Hist(6,9,0) < 0.0]
    ]


    or

    [ //alt 2
    [MACD Line(12,26,9) > 0.0]
    and [MACD Line(12,26,9) < MACD Signal(12,26,9)]
    and [MACD Hist(12,26,9) > 1 day ago MACD Hist(12,26,9)]
    and [MACD Hist(6,9,0) > 1 day ago MACD Hist(6,9,0)]
    and [1 day ago MACD Hist(6,9,0) < 0.0]
    ]

    or

    [ // alt 3
    [ MACD Line(12,26,9) < 0.0]
    and [ MACD Line(12,26,9) < MACD Signal(12,26,9)]
    and [ MACD Line(12,26,9) > 1 day ago MACD Line(12,26,9)]
    and [MACD Hist(6,9,0) > 1 day ago MACD Hist(6,9,0)]
    and [1 day ago MACD Hist(6,9,0) < 0.0]
    ]

    or

    [ // alt 4
    [MACD Line(12,26,9) < 0.0]
    and [MACD Line(12,26,9) > MACD Signal(12,26,9)]
    and [ MACD Line(12,26,9) > 1 day ago MACD Line(12,26,9)]
    and [ MACD Hist(6,9,0) > 1 day ago MACD Hist(6,9,0)]
    and [1 day ago MACD Hist(6,9,0) < 0.0]
    ]

    ] // end or
  • Just found your comments. Thank you. I'll need to study these suggestions.
Sign In or Register to comment.