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

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, 05: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:	269
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.
            I am trying to find a simple example where the enums are shown as is. All examples I have seen tries to add nice looking display strings but I don't want that complexity. Basically I have a class ...
            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.
                Hello All, Moving forward this will be maintained in the help guide reference samples and no longer maintained on the forum. Creating Chart WPF (UI) Modifications from an Indicator - https://ninjatrader.com/support/help...ui)-modifi.htm (https://ninjatrader.com/support/helpGuides/nt8/creating-chart-wpf-(ui)-modifi.htm) I've


                Below is a publicly available link to the 3rd party educational site DotNetPerls with an example.
                Use the WPF ComboBox control with the ItemsSource property in C# code.


                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, 10: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.
                  Chelsea B.NinjaTrader Customer Service

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by alifarahani, Today, 09:40 AM
                  3 responses
                  15 views
                  0 likes
                  Last Post NinjaTrader_Jesse  
                  Started by RookieTrader, Today, 09:37 AM
                  4 responses
                  17 views
                  0 likes
                  Last Post RookieTrader  
                  Started by PaulMohn, Today, 12:36 PM
                  0 responses
                  4 views
                  0 likes
                  Last Post PaulMohn  
                  Started by love2code2trade, 04-17-2024, 01:45 PM
                  4 responses
                  40 views
                  0 likes
                  Last Post love2code2trade  
                  Started by junkone, Today, 11:37 AM
                  3 responses
                  23 views
                  0 likes
                  Last Post NinjaTrader_ChelseaB  
                  Working...
                  X