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.

price alert code

i am trying to compare the $rvx with $tnx. i am using the following code: [[[symbol = '$RVX'] AND [EMA(5,CLOSE) > EMA(13,CLOSE)]]] AND [[[symbol = '$TNX'] AND [EMA(5,CLOSE) < EMA(13,CLOSE)]]] if i comment out the $rvx code i get a correct answere and visa versa. When i put the code together i get no answer. i am using the 12/06 timeframe because that is when both were true. the eventual goal is to put the code into a price alert. can someone help? al


  • You get no answer when you include both symbols in the same alert because "symbol" can equal only one symbol at a time. So it can't be both $RVX and $TNX.

    So I don't think you can do what you are trying to do - get an alert only when two different symbols meet your criteria at the same time.

    I think you would have to have one alert for each, and keep track of whether both have triggered, and whether, when the second one triggers the first is still true - which is not ideal, but I don't see a way around it.
  • [
    [[symbol = '$RVX'] AND [EMA(5,CLOSE) > EMA(13,CLOSE)]]
    [[symbol = '$TNX'] AND [EMA(5,CLOSE) < EMA(13,CLOSE)]]

    This will return 1 symbol when one is true, 2 symbols when both are true, 0 symbols if neither is true.

    You can set up alerts this way as well. I've posted on using naming conventions to group individual symbol type alerts together for clarity purposes.

    Hope this helps?

  • markdmarkd mod
    edited December 2021
    I thought of that, but didn't include it because my question would be, what happens when one triggers? Does it "de-activate" the alert for the day (until you reactivate it), so that if the other triggers you wouldn't actually get an alert for the second because it's already been triggered and retired by the first?
  • if you set the alert to "continue" it will keep running until you change it. There is also a setting for when you want the alert to run, and also the amount of results to trigger notification.

    So you can set it to run at the beginning or end of the day. Continuously or hourly are the other options.

    I mentioned that they scan code would return different results based on the conditions being true on one or both,

    You could set the alert to trigger on 2 results (meaning both are true). I wouldn't, but you could.

    Using that suggested code, the alert would provide the information only when 1 or both are true. No notification if 0 are true.
  • Great! Thanks for the clarification.
Sign In or Register to comment.