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

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 gemify, 11-11-2022, 11:52 AM
      6 responses
      803 views
      2 likes
      Last Post ultls
      by ultls
       
      Started by ScottWalsh, Today, 04:52 PM
      0 responses
      3 views
      0 likes
      Last Post ScottWalsh  
      Started by ScottWalsh, Today, 04:29 PM
      0 responses
      7 views
      0 likes
      Last Post ScottWalsh  
      Started by rtwave, 04-12-2024, 09:30 AM
      2 responses
      22 views
      0 likes
      Last Post rtwave
      by rtwave
       
      Started by tsantospinto, 04-12-2024, 07:04 PM
      5 responses
      70 views
      0 likes
      Last Post tsantospinto  
      Working...
      X