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.
Options

Dependent upon SP500

Is it possible to make this scan contingient upon the SPX weekly MACD Line rising? I know how to write the weekly macd line rising but I'm not sure how to include it in a scan?


[Group is SP500] and [RSI(3) < 30.0] and [MACD Line(12,26,9) > MACD Signal(12,26,9)] and [Weekly MACD Hist(13,26,9) > 1 Week ago MACD Hist(13,26,9)] and [Weekly MACD Line(12,26,9) > 1 Week ago MACD Line(12,26,9)]

Comments

  • Options
    As far as I know, the only relationship you can reference in a scan is using the PctRelative function

    You can use that in a few different ways but requiring the MACD on a different symbol to be rising isn't one of them.

    Examples:
    and [PctRelative(20,$spx) > 0]
    and [PctRelative(20,$Sector) > 0]
    and [PctRelative(20,$Industry) > 0]
    and [PctRelative(20,AAPL) > 0]

    One way you might work around it is if you want the SPX to meet your all of your scan code requirements, you can add it into the scan with ' or Symbol equals spx' near the top of the scan so it's included in the list of things to scan for.

    Otherwise, you could just look at the SPX chart with the MACD on it and note the slope of the lines I suppose. If rising, run scan. If not, don't?

    It's weird how the formatting changed on these messages, adding in extra spaces, since the recent "update".

  • Options
    I haven't actually tried this, but maybe you could use an "or" statement.

    (ignoring proper syntax here, except the or brackets)

    [
    symbol is spx
    and weekly macd rising
    ]

    or

    [

    group is sp500
    all your other conditions

    ]

    With an "or" statement, you will get results for any conditions that are true, so if spx macd is rising, spx will be included in the results. If it's falling, it won't. So if it's not there, you know to ignore the other results. If I remember correctly, if you sort the results by sector or industry or symbol on the results page (or use rank by in the scan), $SPX should come right to the top because it doesn't have a sector or industry (and $ comes before "a" alphabetically), so you don't have to go looking for it.

    But I don't think you can do it so that the scan returns 0 results if spx macd is falling.
  • Options
    Thanks fellas. I appreciate your trying to help again. I know that using SP500 won't work for what I am trying to ask the scan to do. It will select every stock in the SP500 that has a weekly macd line rising.
  • Options
    I'll mess around with some variation of this for a while if I can get something like this to clear syntax, lol. Thanks.


    [[[Symbol is SPX] and [Weekly MACD Line(12,26,9) > Last week's Weekly MACD Line(12,26,9)]] and [Group is SP500] and [RSI(3) < 30.0] and [MACD Line(12,26,9) > MACD Signal(12,26,9)] and [Weekly MACD Hist(13,26,9) > 1 Week ago MACD Hist(13,26,9)] and [Weekly MACD Line(12,26,9) > 1 Week ago MACD Line(12,26,9)]]
  • Options
    The symbol for the SP500 is $SPX, not SPX.

    Your scan won't work because all statements must be true for the scan engine to return a symbol (unless you have an "or" statement in your scan - then, only one of the "or" conditions has to be true). Your scan above is asking (whether you know it or not) for symbols that are both "$SPX" and members of the SP500. Both conditions cannot be true, because $SPX is not a symbol in the SP500, and no symbol in the SP500 is $SPX.
  • Options
    I did not know that. I was hoping that the extra brackets might make it work
  • Options
    markd's suggestion was that you use this type of format

    [symbol is spx and weekly macd rising ]
    OR
    [ group is sp500 and all your other conditions]

    Then, if the weekly macd is rising on the SPX, the SPX will show in your results. If it is NOT rising, it would not show in your results. This way you will know if the macd is rising for the SPX or not. You would still get the results from your SP500 scan. It's just whether the SPX shows in the results or not.
  • Options
    Thank you
Sign In or Register to comment.