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

Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Bulk Disable of Alerts

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Bulk Disable of Alerts

    I'm using alerts to detect certain indicator conditions, and once executed, it submits an ATM order that has a Trailing Stop template. I have a few instruments I am doing this with.

    I'd like to be able to essentially disable all the alerts (so new orders won't be placed) and flatten all open positions if I hit a certain PnL (both positive and negative). Is this possible?

    Thanks in advance.

    #2
    Don't know if you want this programmatically or manually. You can do it manually in HotKeys. The Window in which the Alerts reside must be active.

    Comment


      #3
      Prefer programmatically; once I hit a certain limit automatically flatten and disable alerts.

      Comment


        #4
        Hello ypbtrainer,

        Enabling or disabling manually created alerts is not supported from NinjaScript.

        However, if you wanted to make an addon or strategy that has the logic for sending orders and triggering alerts, it would be possible to code a loss limit into this and when reached have the script send orders to flatten a position and stop sending alerts.

        Below is a link to an example of a loss limit.
        https://ninjatrader.com/support/foru...ples#post93881
        Chelsea B.NinjaTrader Customer Service

        Comment


          #5
          Thanks Chelsea.

          I saw how to flatten positions across an account, but I didn't see any code to actually go through and disable alerts for a set of instruments. I saw an Alert object but not sure what the methods are underneath to be able to disable them. Of course, the reason I have to do this is that I could flatten the positions to get out, but the alerts would still be active, thereby just re-executing positions once the conditions were met again.

          Thanks in advance!

          Comment


            #6
            Hello ypbtrainer,

            I am not aware of a way to disable or enable manually setup alerts.

            If the script itself is triggering the alerts, you can code the logic to not send alerts at certain times. This would mean coding the script to send the alerts instead of setting manual alerts in the Alerts window.
            Chelsea B.NinjaTrader Customer Service

            Comment


              #7
              I see.

              Is there a way, then, after flattening a position, that I can disconnect my account from the data connection, so in effect the alert won't have any impact?

              Or, if not, what would be the best way for me to learn how to code logic for an alert, so I can build what I have done through the Alert UI?

              Comment


                #8
                Hello ypbtrainer,

                To disconnect from a connection, you will need to find the connection (which can be found from an account) and call <connection>.Disconnect().
                https://ninjatrader.com/support/help...disconnect.htm

                Below I am providing links to the help guide on triggering alerts from NinjaScript.
                https://ninjatrader.com/support/help...g_concepts.htm
                https://ninjatrader.com/support/help.../nt8/alert.htm

                As well as a link to a forum post with helpful information about getting started with NinjaScript.
                https://ninjatrader.com/support/foru...040#post786040
                Chelsea B.NinjaTrader Customer Service

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by KeenEdge, Today, 04:08 PM
                0 responses
                1 view
                0 likes
                Last Post KeenEdge  
                Started by aipjcnow, Yesterday, 12:56 PM
                2 responses
                11 views
                0 likes
                Last Post NinjaTrader_ChelseaB  
                Started by Nice-Spread, Yesterday, 02:02 AM
                2 responses
                14 views
                0 likes
                Last Post Nice-Spread  
                Started by jaysinclair, Today, 01:04 PM
                0 responses
                2 views
                0 likes
                Last Post jaysinclair  
                Started by markbb10, Today, 12:48 PM
                0 responses
                7 views
                0 likes
                Last Post markbb10  
                Working...
                X