Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

AtmStrategyCreate from custom SuperDOM column

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

    AtmStrategyCreate from custom SuperDOM column

    When I try to invoke AtmStrategyCreate from my custom SuperDOM column, I get the following exception:
    Unhandled exception: "AtmStrategyCreate" method can only be called in state "Realtime".
    Click image for larger version

Name:	exception.jpg
Views:	1
Size:	15.7 KB
ID:	908188

    I've tried it on market replay as well as with a live account with the same results. Code is attached as well. I'm not sure I understand what is going on here and how to solve the issue.
    Code is here:
    Test.cs

    #2
    Hello gemify,

    Thanks for opening the thread.

    The SuperDOM column never reaches a Data processing state of State.Realtime, it reaches a State.Active instead. As such, you will not be able to initiate an ATM strategy from an AddOn using AtmStrategyCreate().

    To start an ATM strategy from an AddOn, you will have to look at using StartAtmStrategy(). You can use the AddOn Framework sample as an example.

    Code:
    // Submit our Buy Market order with the selected ATM strategy
    if (atmStrategySelector.SelectedAtmStrategy != null)
    {
    	/* When submitted orders with ATM strategies you MUST set the 'name' property to "Entry" in order for it to work.
        Otherwise the entry order will be stuck in OrderState.Initialized and no ATM strategy will be started */
    	entryOrder = accountSelector.SelectedAccount.CreateOrder(Instrument, OrderAction.Buy, OrderType.Market, tifSelector.SelectedTif, qudSelector.Value, 0, 0, string.Empty, "Entry", null);
    	NinjaTrader.NinjaScript.AtmStrategy.StartAtmStrategy(atmStrategySelector.SelectedAtmStrategy, entryOrder);
    }
    // If no ATM strategy selected, submit our Buy Market order alone
    else
    {
    	entryOrder = accountSelector.SelectedAccount.CreateOrder(Instrument, OrderAction.Buy, OrderType.Market, tifSelector.SelectedTif, qudSelector.Value, 0, 0, string.Empty, "AddOnFramework - Buy Market", null);
    	accountSelector.SelectedAccount.Submit(new[] { entryOrder });
    }
    The AddOn Framework sample can be found here - http://ninjatrader.com/support/helpG...t_overview.htm

    StartAtmStrategy() - https://ninjatrader.com/support/help...tmstrategy.htm

    Data Processing States vs. Active States - http://ninjatrader.com/support/helpG...tatechange.htm

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

    Comment


      #3
      Aha! I'll try out StartAtmStrategy. Thanks for the quick response Jim!

      Comment


        #4
        Hi Jim,

        Once we start an ATM Order from an Addon with this method, is there any way to monitor its Market Position, Profit and Loss or any of the methods described below ?


        Thanks !
        pmaglio
        NinjaTrader Ecosystem Vendor - The Indicator Store

        Comment


          #5
          Hello pmaglio,

          Thanks for the question.

          As those methods must be used in the context of a NinjaScript Strategy, it would not be possible to use them directly in the context of an AddOn. I'm not finding an easy way to work around this either.

          I will submit a feature request on your behalf requesting that these methods can also be used in an AddOn. I will update this post when I receive the ticket number for the feature request.

          Ticket ID: SFT-2511

          Keep in mind that feature requests are up to the development team's priorities to consider implementation. Once the feature request is fulfilled, it can be noted in the Release Notes page of the help guide.

          Release Notes: https://ninjatrader.com/support/help...ease_notes.htm

          Please let me know if I can be of further help.
          Last edited by NinjaTrader_Jim; 07-11-2017, 09:14 AM.
          JimNinjaTrader Customer Service

          Comment


            #6
            Any news about this (Ticket ID: SFT-2511) ?
            Ive seen several people asking for the same on the forum "How to get control info about an ATM Order" placed from anywhere BUT a Strategy ( addon, indicator )
            Having the atmStrategyId would be really useful
            pmaglio
            NinjaTrader Ecosystem Vendor - The Indicator Store

            Comment


              #7
              Hello pmaglio,

              We have gotten a few votes but there is no further information we could give at this time. Some NinjaScript related items do not see as much voting attention as say, changing the way Chart Trader looks. If you have clients that would be interested in this functionality but may not necessarily want to program it, we will gladly add votes to track their interest as well.

              If there is anything else I can do to help, please let me know.
              JimNinjaTrader Customer Service

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by benmarkal, Yesterday, 12:52 PM
              3 responses
              23 views
              0 likes
              Last Post NinjaTrader_Gaby  
              Started by helpwanted, Today, 03:06 AM
              1 response
              19 views
              0 likes
              Last Post sarafuenonly123  
              Started by Brevo, Today, 01:45 AM
              0 responses
              11 views
              0 likes
              Last Post Brevo
              by Brevo
               
              Started by pvincent, 06-23-2022, 12:53 PM
              14 responses
              244 views
              0 likes
              Last Post Nyman
              by Nyman
               
              Started by TraderG23, 12-08-2023, 07:56 AM
              9 responses
              388 views
              1 like
              Last Post Gavini
              by Gavini
               
              Working...
              X