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.

Syntax correct ?

I would like to set an alert for the etf "SPY" when the price is above the 200 day MA and the 200 day MA has crossed the 250 day MA. Is my syntax correct?
[symbol ='SPY'] and [close > sma(200)] and [sma(200) x sma(250)]

Best Answer

  • lmkwinlmkwin ✭✭
    Answer ✓
    in both the Advanced Alert and Advanced Scan Workbenches there is a button at the bottom of the input box that reads Check Syntax. Click on that button and it will tell you whether or not the syntax is correct.

    In this case it reads

    so the syntax is correct.


  • Thank you very much
  • Keep in mind that a syntax check is not the same as a logic check. For instance, this is syntactically correct

    and [close > sma(10,close)]
    and [close < sma(10,close)]

    but logically not possible.

    This is an obvious example, but if your scan gets complicated, you may not realize that you could be asking for something that isn't logically possible. Getting zero results could be a clue (although valid scans can get zero results, too, especially if you have a lot of conditions).

    No such problems with this alert.
  • what @markd may be getting at is that if your SPY Close is less than the 200 SMA then the rest of it isn't pertinent. It it fails that greater than test, the cross isn't going to alert.

    If you want the alert to alert you to the cross, then use that section only.
Sign In or Register to comment.