Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Other required NTTabPage members left out for demonstration purposes

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

    Other required NTTabPage members left out for demonstration purposes

    I need to trigger an already created ATM named "xyz21" in my indicator that I use to do order entries (Market, Limit, StopLimit, etc). The indicator is 90% satisfactory. In the course of searching this forum for solutions, I ran into the topic of this my new thread that says "Other required NTTabPage members left out for demonstration purposes. Be sure to add them in your own code. (see a typical link here)". Please, what/where are these NTTabPage members ? It seems that I need the NTTabPage scripts to enable my indicator use my ATM. Please note that my interest is in using an indicator NOT a strategy for my order entries. I shall appreciate any help.

    Regards.

    Omololu

    #2
    Hello Omololu,

    That would not be correct. An NTTabPage is not required to use StartAtmStrategy(). I will make a note to have this documentation changed to note implementing a TabControl is optional.

    A TabControl implements tabs in a custom window. An NTTabPage is the content of a tab.

    Attached is the SubmitOrderWithAtmAddonExample_NT8, found with the link below, created without a TabControl.
    https://ninjatrader.com/support/foru...486#post794486

    Also, below is a link to examples of addons with and without a TabControl.
    http://ninjatrader.com/support/forum...059#post477059
    Attached Files
    Last edited by NinjaTrader_ChelseaB; 10-25-2020, 04:30 PM.
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Originally posted by NinjaTrader_ChelseaB View Post
      Hello Omololu,

      That would not be correct. An NTTabPage is not required to use StartAtmStrategy(). I will make a note to have this documentation changed to note implementing a TabControl is optional.

      A TabControl implements tabs in a custom window. An NTTabPage is the content of a tab.

      Attached is the SubmitOrderWithAtmAddonExample_NT8, found with the link below, created without a TabControl.
      https://ninjatrader.com/support/foru...486#post794486

      Also, below is a link to examples of addons with and without a TabControl.
      http://ninjatrader.com/support/forum...059#post477059
      Hi Chelsea,

      Thanks for the tips and guides. The "SubmitOrderWithAtmAddonNoTabsExample" seems to be on a different path from my path. It is very interesting and I may explore that path in the nearest future. At lease, I learnt how ATM strategy is submitted.

      Meanwhile I'm still not succeeding in my project to trigger an ATM from my indicator and to do order entries (Market, Limit, StopLimit, etc). This is what I have;

      #region Using declarations
      .
      .
      .
      using NinjaTrader.Gui.NinjaScript.AtmStrategy;
      #endregion

      namespace NinjaTrader.NinjaScript.Indicators
      {
      public class myChartTraderIndicator : Indicator
      {
      .
      .
      .
      private NinjaTrader.Gui.NinjaScript.AtmStrategy.AtmStrateg ySelector atmStrategySelector;
      private NinjaTrader.Gui.Tools.AccountSelector accountSelector;
      private NinjaTrader.Gui.Tools.InstrumentSelector instrumentSelector;
      .
      private void OnMyBuyMarketButtonClick(object sender, RoutedEventArgs rea)

      {

      .
      .
      .
      entryOrder = myAccount.CreateOrder(myInstrument, OrderAction.Buy, OrderType.Market, OrderEntry.Manual, TimeInForce.Gtc, 3, 0, 0, "", "entryOrder", Core.Globals.MaxDate, null);
      NinjaTrader.NinjaScript.AtmStrategy.StartAtmStrate gy(atmStrategySelector.SelectedAtmStrategy, entryOrder);
      myAccount.Submit(new[] { entryOrder });


      Please note that I have defined "myAccount" and "myInstrument" correctly and as required. In any case, the indicator successfully compiled but when my order is submitted with a button click, I received the following log error;

      "Unhandled exception: Object reference not set to an instance of an object."

      I observed that when I remove the "NinjaTrader.NinjaScript.AtmStrategy.StartAtmStrate gy(atmStrategySelector.SelectedAtmStrategy, entryOrder)" script, the order got successfully submitted.

      Please, what am I still doing wrongly.

      Regards.

      Omololu

      Comment


        #4
        Hello omololu,

        The example I have provided you was to address your inquiry. This example uses StartAtmStrategy without an NTTabPage in a custom addon window to demonstrate an NTTabPage is not required to use StartAtmStrategy.

        The error: 'Object reference not set to an instance of an object' means a variable with a null value was used.

        What is the variable with null object?

        (You can use prints to find out)

        if (myAccount == null)
        {
        Print("myAccount is null);
        }
        Chelsea B.NinjaTrader Customer Service

        Comment


          #5
          Originally posted by NinjaTrader_ChelseaB View Post
          Hello omololu,

          The example I have provided you was to address your inquiry. This example uses StartAtmStrategy without an NTTabPage in a custom addon window to demonstrate an NTTabPage is not required to use StartAtmStrategy.

          The error: 'Object reference not set to an instance of an object' means a variable with a null value was used.

          What is the variable with null object?

          (You can use prints to find out)

          if (myAccount == null)
          {
          Print("myAccount is null);
          }
          Hi Chelsea,

          I've made a good progress in my ChartTrader indicator project ... THANKS for your tips and guides.

          In the course of going through your tips and guide, I got introduced to the SubmitOrderWithAtmAddonNoTabsExample Addon, and which looks very interesting. I will want to tweak the Addon to include ORDER ACTION (Buy and Sell) and ORDER TYPE (Market, Limit and StopLimit) and as shown in my attached screenshot. Please, is this feasible ? If Yes, could you please give me some tips and guides again.

          Regards.

          Omololu

          Click image for larger version

Name:	Submit Order With ATM.png
Views:	52
Size:	14.0 KB
ID:	1125033

          Comment


            #6
            Hello Omololu,

            Likely you will need to add a combobox (or ntmenu) which you can populate with values.

            Then you can compare the selected value of the combobox to an enum value (.ToString()) to see if the user has selected that value.

            It may be possible to use binding to bind the combobox to an enum, but that would be getting outside of what the NinjaTrader Support team supports.
            https://stackoverflow.com/questions/...n-wpf/28173189
            Chelsea B.NinjaTrader Customer Service

            Comment


              #7
              Originally posted by NinjaTrader_ChelseaB View Post
              Hello Omololu,

              Likely you will need to add a combobox (or ntmenu) which you can populate with values.

              Then you can compare the selected value of the combobox to an enum value (.ToString()) to see if the user has selected that value.
              Thanks Chelsea for your reply.

              Please, could you direct me to example scripts/codes to add combobox/ntmenu ?

              Regards.

              Omololu

              Comment


                #8
                Hello Omololu,

                I am not aware of any publicly available addons that use a combo box. This would fall under general C# and WPF.

                I can provide an example that adds a menu.
                https://ninjatrader.com/support/foru...07#post1124507

                Below is a publicly available link to the 3rd party educational site DotNetPerls with an example.
                https://www.dotnetperls.com/combobox-wpf

                Below is a public link to a google search of 'system.windows.controls.combobox example'.
                https://www.google.com/search?safe=a...mbobox+example
                Last edited by NinjaTrader_ChelseaB; 10-28-2020, 09:40 AM.
                Chelsea B.NinjaTrader Customer Service

                Comment


                  #9
                  Hello Omololu,

                  After some searching I found an example of a combox box with binding you may find helpful.
                  https://ninjatrader.com/support/foru...85#post1045985
                  Chelsea B.NinjaTrader Customer Service

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by pvtrader, Today, 08:02 AM
                  0 responses
                  3 views
                  0 likes
                  Last Post pvtrader  
                  Started by Natoc, Today, 03:04 AM
                  1 response
                  13 views
                  0 likes
                  Last Post NinjaTrader_Jason  
                  Started by Rudy2323, Today, 02:56 AM
                  2 responses
                  23 views
                  0 likes
                  Last Post Rudy2323  
                  Started by tonynt, Yesterday, 02:07 PM
                  1 response
                  33 views
                  0 likes
                  Last Post NinjaTrader_Jason  
                  Started by sgordet, Yesterday, 01:57 PM
                  1 response
                  33 views
                  0 likes
                  Last Post NinjaTrader_Jason  
                  Working...
                  X