Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

AtmStrategySelector Bug

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

    AtmStrategySelector Bug

    Hello Forum,

    I'm attempting to use the ChartTrader and AtmStrategySelector to let a user running my strategy select an ATM from the chart trader and my strategy to open and manage a trade with the ATM. The first step in this is capturing the name of the ATM currently selected in the ChartTrader.

    Here's the interesting part. The code below is only able to report names of ATMs I created in NT7 and were imported in the upgrade process. ATMs I created with NT8 don't work. They always return the name 'ATMStrategy'. Additionally, the id is always -1 regardless if it is returning the correct name.

    To see the results I put a call to the code below in OnBarUpate and look at the output window.

    Any feedback or input on getting this right is much appreciated.

    Code:
    protected bool UseATM()
    {
       try
       {
           //Dispatcher used to Assure Executed on UI Thread
           this.Dispatcher.Invoke((Action)(() =>
           {
              chartTrader = Window.GetWindow(ChartControl.Parent).FindFirst("ChartWindowChartTraderControl") as ChartTrader;
    
              NinjaTrader.Gui.NinjaScript.AtmStrategy.AtmStrategySelector selector = chartTrader.FindFirst("ChartTraderControlATMStrategySelector") as NinjaTrader.Gui.NinjaScript.AtmStrategy.AtmStrategySelector;
    
    
              Print("SelectedAtmStrategy: " + selector.SelectedItem.ToString());
    
            }));
    
                return true;
       }
       catch (Exception ex) { Print("UseATM: " + ex.Message.ToString()); return false; }
    
    }
    Last edited by daqu40; 02-10-2017, 09:13 AM.
    daqu40
    NinjaTrader Ecosystem Vendor - QTradez

    #2
    Hello,

    Thank you for the post.

    I believe this is the object you are using to check what is selected, the ATM selector uses a custom object called SelectedAtmStrategy

    You can find a post about this concept I made here: http://ninjatrader.com/support/forum...44&postcount=7

    I look forward to being of further assistance.

    Comment


      #3
      Thanks Jesse,

      That post is where I started and what my method is based on.

      I encourage you to drop my method on to a strategy or indicator and see for yourself that it works for some ATMs and not others.
      daqu40
      NinjaTrader Ecosystem Vendor - QTradez

      Comment


        #4
        Hello daqu40,

        I would not suggest to use the code you have provided as this is not the correct object to be used in this situation. Because this control uses a custom object for its SelectedItem you would need to use that instead. The SelectedItem is a general property of dropdown or combo boxes, this may give some information on the object it selects but is not a substitue for using the methods NInjaTrader built for this specific object.

        If you see while using the SelectedAtmStrategy property that some show up and some do not, I would like to see the sample of that situation and likely get the original NT7 ATM strategy so that I can migrate and test that situation as well.

        I look forward to being of further assistance.

        Comment


          #5
          Well, let's cut to the chase. What is the correct object to use for getting the name of the currently selected ATM in the ChartTrader?

          I'm also happy to provide my ATMs in the attached zip file so this can be further investigated on your end.
          Attached Files
          daqu40
          NinjaTrader Ecosystem Vendor - QTradez

          Comment


            #6
            Hello,

            The correct object is shown in the sample that I provided the link for, I also have provided its in my prior posts.

            You are using: selector.SelectedItem where as the sample is using: selector.SelectedAtmStrategy

            If you copy and paste the example from the forum post, you can compare it to what you are using currently in your script to see the difference.

            Please let me know if I may be of further assistance.

            Comment


              #7
              Thanks Jesse,

              I made the change and am now using

              Code:
              Print("SelectedAtmStrategy: " + selector.SelectedAtmStrategy.ToString());
              and the result is the same. ATMs converted from NT7 will show their name and ones created in NT8 won't.

              the output:

              SelectedAtmStrategy: name='AtmStrategy' id=-1
              SelectedAtmStrategy: name='AtmStrategy' id=-1
              SelectedAtmStrategy: name='C12S25T2.10' id=-1
              SelectedAtmStrategy: name='C12S25T2.10' id=-1
              SelectedAtmStrategy: name='C12S25T2.10' id=-1
              SelectedAtmStrategy: name='C12S25T2.10' id=-1
              SelectedAtmStrategy: name='C12S25T2.10' id=-1
              SelectedAtmStrategy: name='C12S25T2.10' id=-1
              SelectedAtmStrategy: name='C12S25T2.10' id=-1
              SelectedAtmStrategy: name='C12S25T2.10' id=-1
              SelectedAtmStrategy: name='C12S25T2.10' id=-1
              SelectedAtmStrategy: name='AtmStrategy' id=-1
              SelectedAtmStrategy: name='AtmStrategy' id=-1
              SelectedAtmStrategy: name='AtmStrategy' id=-1
              SelectedAtmStrategy: name='AtmStrategy' id=-1
              SelectedAtmStrategy: name='AtmStrategy' id=-1
              SelectedAtmStrategy: name='AtmStrategy' id=-1
              SelectedAtmStrategy: name='AtmStrategy' id=-1
              SelectedAtmStrategy: name='C3S14T3.9.30' id=-1
              Disabling NinjaScript strategy 'BCEntry/95561324'
              12/26/2016 4:01:21 PM CancelAllOrders: BarsInProgress=0
              The ones with 'AtmStrategy' were built in NT8, the ones starting with 'C' were converted from NT7.
              daqu40
              NinjaTrader Ecosystem Vendor - QTradez

              Comment


                #8
                Hello,

                Thank you for the reply.

                Could you please follow up on this post through email so you can provide your Database from NT7? I would like to do the whole migration process to see this occur. In the case there is a problem migrating the strategies I would want to report that to development. The correct object to use to get the selected ATM would be that of the samples I have provided, if that is not working potentially the migration is not completely working on these specific items.

                In NT7 You can do this by going to the Control Center-> Help-> Mail to Platform Support.

                Ensure to check 'Database file' is checked.

                Please reference this forum post in the body of the message.




                I look forward to being of further assistance.

                Comment


                  #9
                  Will do Jesse,

                  Note the problem is NT8 ATM names aren't exposed by the code. NT7 ones are.
                  daqu40
                  NinjaTrader Ecosystem Vendor - QTradez

                  Comment


                    #10
                    Hello,

                    Thank you for the reply.

                    In this case, it appears we are looking at the incorrect property for the name specifically, although there is a Name property this is not what strategy saves the Template name as specifically. The "Template" property would equate to the Name whereas NT7 used the Name property previously it appears. I was able to see the items you provided reporting their names as well as the NT8 strategies.

                    For further clarification of what properties are equal to what values, you could open the ATM strategy .xml file in a text editor to see the values that go with each property. This could give you a better idea for other items where the property may be unknown.

                    Print(selector.SelectedAtmStrategy.Template);

                    I look forward to being of further assistance.

                    Comment


                      #11
                      Thanks Jesse,

                      This works!

                      And thanks for the tip on looking at the xml elements. I wasn't aware that each would be considered a property to the SelectedAtmStrategy.
                      daqu40
                      NinjaTrader Ecosystem Vendor - QTradez

                      Comment

                      Latest Posts

                      Collapse

                      Topics Statistics Last Post
                      Started by NullPointStrategies, Yesterday, 05:17 AM
                      0 responses
                      66 views
                      0 likes
                      Last Post NullPointStrategies  
                      Started by argusthome, 03-08-2026, 10:06 AM
                      0 responses
                      141 views
                      0 likes
                      Last Post argusthome  
                      Started by NabilKhattabi, 03-06-2026, 11:18 AM
                      0 responses
                      76 views
                      0 likes
                      Last Post NabilKhattabi  
                      Started by Deep42, 03-06-2026, 12:28 AM
                      0 responses
                      47 views
                      0 likes
                      Last Post Deep42
                      by Deep42
                       
                      Started by TheRealMorford, 03-05-2026, 06:15 PM
                      0 responses
                      51 views
                      0 likes
                      Last Post TheRealMorford  
                      Working...
                      X