• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.


No announcement yet.

Partner 728x90


ReArm an Alert

  • Filter
  • Time
  • Show
Clear All
new posts

    ReArm an Alert

    I'm using an ADX indicator. I want it to trip an alert on a rise. It will do it now but only once. I want it to trip and alert on the rise and when it goes down and then starts to rise again I would like it to alert again.

    The script so far:

    // Condition set 1
    if (Rising(ADXmulticolor7(14).ADX) == true)
    Alert("MyAlert2", Priority.High, "", @"C:\Program Files (x86)\NinjaTrader 7\sounds\Alert1.wav", 0, Color.White, Color.Black);



    Hello Segwin,

    Thanks for your post.

    Based on your other posts I've seen I will assume you are talking about NT7 and are using the strategy wizard for this. If this is not correct please advise so that I can provide the correct information to assist you.

    The Alert statement has a rearm time of 0 (zero) which means it will only fire once. You can set this to some positive (seconds) value that will allow the alert to fire again when the rising condition is true and the rearm time has completed. Please see the helpguide on Alert: http://ninjatrader.com/support/helpG...nt7/?alert.htm for clarity of the Alert statement and parameters.

    Also, when you use Alerts you can display a list of alerts that have occurred with the File>new>alerts window which will show the alerts with a time stamp. You can also (in the Alert statement) add a message which will be displayed in this window.

    For the request of, "I want it to trip and alert on the rise and when it goes down and then starts to rise again I would like it to alert again. " You will need to develop your strategy plan with as much definition as possible to clarify those conditions so that they can be added into the conditions window.
    1) trip and alert on the rise - this is what it does now and if you change the rearm time from 0 (zero) it will alert on each rise when the time condition is satisfied.
    2) When it goes down and then starts to rise again - This you would need to think about, do you mean the condition if Falling(...) is true? For your understanding, both Rising and Falling are only comparing the current value of the previous value, so in a matter of 3 datapoints you can have both conditions. Alternatively, would the rearm time of the alert be enough here?

    In the strategy wizard you do have the use of internal variables identified as Variable0 - Variable9 which can be set and used as needed. If you set Variable0 to a value of 1 you can then check that variable in another condition to see if it is set to 1. Using the variable as a 0 or 1 condition you can use them like bool variables so that when you have one condition true you set a variable value, when you have the 2nd condition true that also checks the previously set variable and then you can act on the two conditions.

    In pseudo code

    set 1 - Conditions: if adx is rising and Variable2 == 0, Actions: set Variable0 =1, set alert()

    set 2 - Conditions: if adx is falling and Variable0 == 1, Actions: set variable0 = 1 and set Variable1 = 1 and set Variable2 = 0

    set 3 - Conditions: if adx is rising and Variable1 == 1, Actions: set alert() and set Variable0 =0 and Variable1 = 0

    In the above, set 1 is only used once to start the process (used once because in set 2 Variable2 is set to 1, then it ping pongs between set 2 and set 3 where set 2 looks for falling condition and sets variables so that when rising set 3 will fire the alert once then resets variables to again let set 2 look for falling.

    No doubt this can become a confusing problem when you combine the ream time and the conditions above so it will take some understanding of the functions which is why I've tried to elaborate as much as possible. What I would advise is that for each set that is true, that you have as an action to draw a colored dot on the chart a few ticks below the bar (and each set to draw its dot at a different level of ticks) so that you can visually see what sets are true and when, this will be a great debugging aid.
    Paul H.NinjaTrader Customer Service


      Thank you very much Paul. That was a very informative post which, I'm sure, took you some time to put together.

      I can do a lot of things well but building code isn't one of them unfortunately.

      Thanks again for your help.



      Latest Posts


      Topics Statistics Last Post
      Started by Audiofail, Today, 05:40 AM
      6 responses
      Last Post willwin
      by willwin
      Started by jerblaster23, Today, 03:42 PM
      1 response
      Last Post NinjaTrader_ChelseaB  
      Started by brian meade, Today, 01:39 PM
      2 responses
      Last Post brian meade  
      Started by Johnny Santiago, Today, 12:20 PM
      1 response
      Last Post NinjaTrader_ChrisL  
      Started by NinjaTrader_Brandon, Today, 10:24 AM
      0 responses
      Last Post NinjaTrader_Brandon