Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Same strategy running on multiple charts?

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

    Same strategy running on multiple charts?

    Is there a conflict if I run the same strategy on the same instrument but on different charts, different time frames?

    I have a custom trailing stop that kicks in X ticks above the entry and the Atr trailing stop becomes the trailing stop.

    It has always worked fine... occasionally I would have to reset the strategy because the trailing stop would kick in as soon as a trade was entered.

    Recently it seems far more "buggy".

    I cannot figure out the problem and the only thing different is have the same strategy on multiple charts.
    Last edited by sdauteuil; 11-09-2020, 10:40 PM.

    #2
    Hello sdauteuil,

    Thanks for your post.

    "Is there a conflict if I run the same strategy on the same instrument but on different charts, different time frames?" Yes, if they are all using the same account, each strategy will be performing live trades but with one account you can only have one account position of Long, short, or Flat, this means that (for example) while one strategy may be long when another strategy goes short the actual account would then become flat yet the strategies both continue as if long and short respectively. The strategies will continue to place live trades regardless of the account position and regardless of the other strategies. This means that a strategy that was long still thinks it is long and when it reaches a profit target or stop (as determined by the strategy code) the strategy would issue a live sell order which if the account was flat would leave the account now short. Or if the account was already short 1 it would now be short 2.

    To avoid any conflicts, you would need to use separate accounts for each strategy instance on the same instrument or run only one strategy per instrument.

    Paul H.NinjaTrader Customer Service

    Comment


      #3
      I have separate accounts for the long and shorts.

      When I have the strategy running on 2 charts and 2 time frames on the same account when one enters a trade I turn the other one off.

      So there is only one position at a time in any account.

      I have a variable that keeps track of the "trigger state"


      When the position is flat TriggerState = 0

      When a trade executes the TriggerState =1 and the TriggerPrice is set to averagepostion + plus the TriggerAmount... (1000 + 10 = the trailing stop will engage at 1010)

      When the Close[0] > TriggerPrice then TriggerState = 2 the Atr Trailing Stop indicator is now the trailing stop.

      When TriggerState == 2 and close[0] < AtrTrailing stop position is closed... Or the profit target is hit whichever comes first.



      I am wondering if the trigger state from one chart can have a conflict with another?

      Chart1 enters a trade and the TriggerState = 1
      at the same time Chart2 is still in TriggerState = 0

      so there is a lag where the 2 charts are in different states until I can disable the strategy on Chart2.

      I would say everything works fine 70% of the time. The other times either the trailing stop engages immediately or doesn't engage at all.
      I have been watching the output and I can see when there is a problem the relationship between the TriggerState and the TriggerPrice is off.

      I am running sim with the same strategy on different sim accounts to see if that changes anything.

      It is unrealistic for me to have an account for every time frame... currently I am using the same strategy on 2 or 3 different time frames and I have 3 separate strategies...
      Basically I would need about 9 accounts or have a separate named strategy for each instance of use.


      Sorry for being long winded but appreciate the help.

      Comment


        #4
        Hello sdauteuil,

        Thanks for your reply.

        I would suggest that you add print statements to your strategies and have them print the variables on each bar so that you know what the state of these entry/exit conditions are in each strategy. Here is a link to our debugging tips: https://ninjatrader.com/support/help...script_cod.htm

        In the long run, you might find it easier to combine the strategies into one strategy.
        Paul H.NinjaTrader Customer Service

        Comment


          #5
          Originally posted by NinjaTrader_PaulH View Post
          Hello sdauteuil,

          Thanks for your post.

          "Is there a conflict if I run the same strategy on the same instrument but on different charts, different time frames?" Yes, if they are all using the same account, each strategy will be performing live trades but with one account you can only have one account position of Long, short, or Flat, this means that (for example) while one strategy may be long when another strategy goes short the actual account would then become flat yet the strategies both continue as if long and short respectively. The strategies will continue to place live trades regardless of the account position and regardless of the other strategies. This means that a strategy that was long still thinks it is long and when it reaches a profit target or stop (as determined by the strategy code) the strategy would issue a live sell order which if the account was flat would leave the account now short. Or if the account was already short 1 it would now be short 2.

          To avoid any conflicts, you would need to use separate accounts for each strategy instance on the same instrument or run only one strategy per instrument.
          Throughout the forum, this scenario of trading more than one strategy on multiple charts of the same instrument at the same time is presented as a bad thing.

          The rationalization is always that the strategies will be out of sync with the account.

          Yet I don't see why that's a problem. In all of my testing things work just fine.

          I can look at the Strategies tab and see the strategy and account positions and it all makes perfect sense. The account position is always the net position exactly as you would want.

          In the screen shot below I'm running (in playback) the same strategy twice on separate charts of the same instrument with slightly different parameters.

          The strategy uses stop market entries and stop loss and profit target exits. Managed mode.

          I've also assigned different signal names to each instance of the strategy.

          Everything works fine.

          So why are the responses in the forum always encouraging people to combine things into one strategy?

          Are there other potential problems? Are there things I'm missing?

          Cause this seems like a perfectly workable scenario to me.


          Click image for larger version

Name:	image.png
Views:	86
Size:	101.9 KB
ID:	1326272

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by haimcn, 03-21-2025, 05:16 PM
          6 responses
          23 views
          0 likes
          Last Post haimcn
          by haimcn
           
          Started by renosdim01, Yesterday, 07:45 AM
          3 responses
          23 views
          0 likes
          Last Post NinjaTrader_Gaby  
          Started by FOKS_444, Today, 07:40 AM
          3 responses
          13 views
          0 likes
          Last Post NinjaTrader_ChelseaB  
          Started by Dudley, Today, 09:52 AM
          1 response
          4 views
          0 likes
          Last Post NinjaTrader_LuisH  
          Started by TraderTimmy71, Today, 09:19 AM
          2 responses
          9 views
          0 likes
          Last Post TraderTimmy71  
          Working...
          X