Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Way to dynamically switch between accounts (sim or other)

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

    Way to dynamically switch between accounts (sim or other)

    Strategies seem to run "hot" or "not so hot" in phases. Enjoying a series of winners and then a series of losers.

    I'd like to be able to use the strategy's trade profit/loss stream as an entry filter and not place real trades (or historically) when recent trade history is poor, but wish to monitor / simulate trades while in the poor state so we can know when to switch back to real trade submission as we re-enter the hot phase.

    Is there a way to programmatically switch Accounts associated with a strategy instance, both within the context of historical and realtime?

    Is there alternate approach that could meet this requirement, other than writing my own order/fill emulator and placing pseudo entry/exit orders to that?

    Perhaps two instances of the same strategy, one bound to a sim, the other bound to a real account, with the sim sending signals to other real account instance? Any thoughts or suggestions are very welcome.

    #2
    Hello volIQ,

    For a strategy that would not be possible, a strategy is enabled on a specific account and to change the account you would need to restart the strategy.Using two strategies would be the next best approach, you could add a custom button which toggles the logic for the strategy, you would have two buttons and then click whichever one you wanted to work at that time and click the other to disable it.

    There is a sample of adding buttons here: https://ninjatrader.com/support/help...ub=usercontrol

    Comment


      #3
      I would suggest that rather than "switching accounts" you simply have the strategy keep track of its own hypothetical equity curve and whatever simple statistics you require, then only place the trades when your meta condition is true e.g. its equity curve is above its own MA or whatever you want there. You can easily add inputs for modes of operation, so you can tell it to take all trades for testing purposes or only follow the business rules e.g. when it's not on a losing streak. Remember, only certain kinds of strategies are amenable to switching approaches. Trend following strategies or breakout strategies do not generally do well with this because they are counting on an occasional home run to make up for many small losses, and they'll be switched off when the home run finally comes in. Other kinds of strategies like mean reversion or scalping strategies with fixed stops and targets are a little easier to adapt this kind of approach. You should analyze the runs in your outcomes to see if your strategy has this kind of weakness when it takes all of the trades e.g. long strings of consecutive losing trades. If it does not, switching may actually make things worse, but for some strategies (especially brittle ones with exits fixed at X ticks etc.) switching can help.
      Bruce DeVault
      QuantKey Trading Vendor Services
      NinjaTrader Ecosystem Vendor - QuantKey

      Comment


        #4
        First of all you need to prove correlation using Z score or linear correlation coefficient. Null hypothesis testing is your friend. I can promise you that in 97-99% there is no correlation. It so rare to see one. If you just assume correlation w/o proving, well you may do yourself more harm than good.

        Back to your original question. Make 2 strategies run on the same market, one on sim (always enabled), the other on live. SIM strategy can set some bool in some static class and Live strategy check it before entering a trade.

        Comment


          #5
          question for Bruce:
          Hi Bruce. I've been trying to come up with an equity curve solution such as you suggest. Could you share an idea regarding a way for the strategy to "keep track of its own hypothetical equity curve"? At most basic, I'm thinking along the lines of:

          if (long condition == true) {set price variable A}
          if (exit condition == true) {set price variable B}
          profit = B - A * PointValue

          and so on....and while [some equity curve condition] == true, trade according to conditions.

          Over time, however, we're going to fall out of correlation, so there's that...


          thanks,
          David
          Last edited by trader3000a; 10-17-2023, 12:53 PM.

          Comment


            #6
            Leroy, Have you been able to achieve this:

            "Make 2 strategies run on the same market, one on sim (always enabled), the other on live. SIM strategy can set some bool in some static class and Live strategy check it before entering a trade."?

            Support tells me strategies aren't able to communicate. Could you share a method?

            thanks,
            David

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by NullPointStrategies, Today, 05:17 AM
            0 responses
            23 views
            0 likes
            Last Post NullPointStrategies  
            Started by argusthome, 03-08-2026, 10:06 AM
            0 responses
            120 views
            0 likes
            Last Post argusthome  
            Started by NabilKhattabi, 03-06-2026, 11:18 AM
            0 responses
            63 views
            0 likes
            Last Post NabilKhattabi  
            Started by Deep42, 03-06-2026, 12:28 AM
            0 responses
            41 views
            0 likes
            Last Post Deep42
            by Deep42
             
            Started by TheRealMorford, 03-05-2026, 06:15 PM
            0 responses
            45 views
            0 likes
            Last Post TheRealMorford  
            Working...
            X