Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

How to add pop ups

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

    How to add pop ups

    Dear members,

    How to add pop up window while triggering buy/sell/target/stoploss
    and how to add trigger price along with buy/ sell signal

    #2
    Hello,

    Thanks for your post.

    Creating a message box (pop up) would be outside of the scope of what we can support as we do not have any native methods to do so, although it is technically possible.

    Please see the following thread to help get you started with some ideas on how you can create alerts other messages:



    If you truly would like a pop-up window, I'd suggest looking into the MessageBox class provided by the .NET Framework:

    Displays a message window, also known as a dialog box, which presents a message to the user. It is a modal window, blocking other actions in the application until the user closes it. A MessageBox can contain text, buttons, and symbols that inform and instruct the user.


    If you'd like this to come up once a specific order has been triggered, you can use the OnOrderUpdate method to check for order updates. Below is an example of using OnOrderUpdate or OnExecution to check for order states:

    The OnOrderUpdate() and OnExecution() methods are reserved for experienced programmers. Instead of using Set() methods to submit stop-loss and profit target orders, you can submit and update them manually through the use of IOrder and IExecution objects in the OnOrderUpdate() and OnExecution() methods. The OnOrderUpdate()


    Can you define what you mean by add trigger price?
    MatthewNinjaTrader Product Management

    Comment


      #3
      Thank you. but I have wrongly mentioned message box as pop up

      Originally posted by NinjaTrader_Matthew View Post
      Hello,

      Thanks for your post.

      Creating a message box (pop up) would be outside of the scope of what we can support as we do not have any native methods to do so, although it is technically possible.

      Please see the following thread to help get you started with some ideas on how you can create alerts other messages:



      If you truly would like a pop-up window, I'd suggest looking into the MessageBox class provided by the .NET Framework:

      Displays a message window, also known as a dialog box, which presents a message to the user. It is a modal window, blocking other actions in the application until the user closes it. A MessageBox can contain text, buttons, and symbols that inform and instruct the user.


      If you'd like this to come up once a specific order has been triggered, you can use the OnOrderUpdate method to check for order updates. Below is an example of using OnOrderUpdate or OnExecution to check for order states:

      The OnOrderUpdate() and OnExecution() methods are reserved for experienced programmers. Instead of using Set() methods to submit stop-loss and profit target orders, you can submit and update them manually through the use of IOrder and IExecution objects in the OnOrderUpdate() and OnExecution() methods. The OnOrderUpdate()


      Can you define what you mean by add trigger price?
      I have added the messagebox from this code
      protected override void OnBarUpdate() { MessageBox.Show("This is an OnBarUpdate() test", "Testing OnBarUpdate()!"); }but how to add message box after buy/sell signals

      and how to add price (like buy @ XXX.XX) above/below the signals

      Thanks in advance

      Comment


        #4
        To clarify: are you looking for a pop-up for manual orders, or orders that come from the same NinjaScript strategy you're working on?
        MatthewNinjaTrader Product Management

        Comment


          #5
          Re: Clarification

          I am looking for indicators neither strategy nor trades.

          Comment


            #6
            You can pass any value you wish into the message box window. If you have a specific price for your signal when that condition is true, you can reference that however it is you're determining what the price is through code.

            For example, if your buy signal was the High of the previous bar, you could use:

            Code:
            	MessageBox.Show("buy @ " + High[1].ToString());
            MatthewNinjaTrader Product Management

            Comment


              #7
              Thanks a lot.
              How can I plot the price with buy/sell signals. like buy @ the price buy signal.

              Comment


                #8
                You can use any of the DrawMethods to visualize this information your chart:



                For example you can use the DrawText() method:

                Code:
                DrawText("tag1", buyPrice.ToString(), 0, buyPrice, Color.Black);
                ref: http://www.ninjatrader.com/support/h...7/drawtext.htm
                MatthewNinjaTrader Product Management

                Comment


                  #9
                  Not sure that MessageBox is a good idea because it blocks the single NT 7 UI thread, and if someone puts MessageBox in something like OnBarUpdate, then odd sequencing or context issues arise that would be unexpected to most users.
                  Example:
                  Code:
                  protected override void OnBarUpdate()
                          {
                              if (Historical) return;
                            _mySeqCount1++;
                              string s = string.Format("CurrentBar={0}, Time[0]={1}, _mySeqCount1={2}, _mySeqCount2={3}", CurrentBar, Time[0], _mySeqCount1, _mySeqCount2);
                              Print("Pre-MessageBox: " + s);
                              MessageBox.Show(s);
                              _mySeqCount2++;
                              Print(string.Format("Processing stuff that must be in correct bar context. CurrentBar={0}, Time[0]={1}, _mySeqCount1={2}, _mySeqCount2={3}", CurrentBar, Time[0], _mySeqCount1, _mySeqCount2));
                  }
                  Output
                  Pre-MessageBox: CurrentBar=1050, Time[0]=03/12/2013 18:55:43, _mySeqCount1=1, _mySeqCount2=0
                  Pre-MessageBox: CurrentBar=1051, Time[0]=03/12/2013 18:55:59, _mySeqCount1=2, _mySeqCount2=0
                  Pre-MessageBox: CurrentBar=1052, Time[0]=03/12/2013 18:56:42, _mySeqCount1=3, _mySeqCount2=0
                  (user has allowed 3 bars to be completed without pressing OK. User now presses OK on all three)
                  Processing stuff that must be in correct bar context. CurrentBar=1052, Time[0]=03/12/2013 18:56:42, _mySeqCount1=3, _mySeqCount2=1
                  Processing stuff that must be in correct bar context. CurrentBar=1052, Time[0]=03/12/2013 18:56:42, _mySeqCount1=3, _mySeqCount2=2
                  Processing stuff that must be in correct bar context. CurrentBar=1052, Time[0]=03/12/2013 18:56:42, _mySeqCount1=3, _mySeqCount2=3
                  So older bar CurrentBar code was only executed after subsequent bars were started, resulting in the incorrect NT context info (such as CurrentBar) being used in earlier bars.

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by mattbsea, Today, 05:44 PM
                  0 responses
                  5 views
                  0 likes
                  Last Post mattbsea  
                  Started by RideMe, 04-07-2024, 04:54 PM
                  6 responses
                  33 views
                  0 likes
                  Last Post RideMe
                  by RideMe
                   
                  Started by tkaboris, Today, 05:13 PM
                  0 responses
                  4 views
                  0 likes
                  Last Post tkaboris  
                  Started by GussJ, 03-04-2020, 03:11 PM
                  16 responses
                  3,282 views
                  0 likes
                  Last Post Leafcutter  
                  Started by WHICKED, Today, 12:45 PM
                  2 responses
                  20 views
                  0 likes
                  Last Post WHICKED
                  by WHICKED
                   
                  Working...
                  X