Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

AccountSelector change not changing strategy.

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

    AccountSelector change not changing strategy.

    I have a strategy running on a chart that has Chart Trader showing.
    My strategy listens to the AccountSelector.SelectionChanged event.
    When the user changes the account on the chart trader panel, my strategy code is detecting the change successfully.

    However, after that change, when an order is submitted (using EnterLong or EnterShort methods), the order is submitted using the original account (ignoring the account showing in ChartTrader).

    Shouldn't the strategy also detect the account change? If my code can detect that change I think the strategy should also.

    Gary

    #2
    Hello GaryAlbers,

    Thanks for writing in.

    The EnterLong() and EnterShort() methods from the Managed Approach are not intended for submitting orders from an added account. You will need to use Account.CreateOrder() to submit orders from an additional account.

    Please see the documentation and related forum thread below:
    Account Class - https://ninjatrader.com/support/help...ount_class.htm
    Account.CreateOrder() - https://ninjatrader.com/support/help...reateorder.htm
    Relevant forum post with sample code - http://ninjatrader.com/support/forum...60&postcount=2

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

    Comment


      #3
      Hello GaryAlbers,

      I just wanted to follow up from our email correspondence as you noted you would like to see this posted to the forum as well:

      I believe there was some confusion with the forum post. Using the Managed approach, you would need to select the Account from the Account dropdown which is built into every strategy. There is no supported way to change this dynamically and would require that the user manually selects the account before manually enabling the strategy. A strategy by nature can only have a single account and can only submit orders to a single account, changing the account would require disabling and re-enabling the script.

      If you are instead working with the Addon order methods like Submit, these utilize an Account object which you can create an AccountSelector to pick. In this specific case, your Submit methods would need to be tied to an Account variable and would only apply to the Account and not be associated with the strategy.

      Strategy order entry methods are a completely different system than the Addon/Account order entry methods and cannot be combined.

      For further information on these concepts, we have the following document which outlines Strategy order entry methods: http://ninjatrader.com/support/helpG...er_methods.htm

      You could also submit orders in a Non- stratetgy way like a manual tool such as the superdom, this would be the Addon/Account way: http://ninjatrader.com/support/helpG...-us/submit.htm

      In the case you are using the Addon/Account way, you would need to remove all EnterLong/EnterShort or Enter methods and just use Submit to open orders. In the case the account does not change in this situation, it would specifically be related to the logic you use to change accounts with the AccountSelector control.



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

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by rafaelabe1977, Today, 08:34 AM
      2 responses
      4 views
      0 likes
      Last Post s.kinra
      by s.kinra
       
      Started by ayrton74, Today, 08:40 AM
      0 responses
      2 views
      0 likes
      Last Post ayrton74  
      Started by qm trader, Yesterday, 05:51 PM
      2 responses
      22 views
      0 likes
      Last Post NinjaTrader_ChrisL  
      Started by pdennis, Today, 07:43 AM
      1 response
      6 views
      0 likes
      Last Post NinjaTrader_Jesse  
      Started by NinjaTrader_Brandon, Today, 07:49 AM
      0 responses
      13 views
      0 likes
      Last Post NinjaTrader_Brandon  
      Working...
      X