Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Undesired trades at first bar of session - Multistrategies on one instrument

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

    Undesired trades at first bar of session - Multistrategies on one instrument

    Hi guys,

    I am having an specific problem in first bar of session when running several automated strategies in real time. Every day I found a "flash trade" like the one in the attached file. In the first 5-20 seconds of session a random strategy (is always a different one) open and close a long position with one contract. In this case, open at 08:00:05 s and close at 08:00:07.

    Let me explain my strategies configuration;

    1) I am running 16 strategies in one account (for long positions) and 16 strategies in a different account (for short positions). NOT all of them trade at the same time, up to 5 will open long/short positions in the same session.
    2) I am running all strategies on the same instrument FESX but on two different account (one for long and for short positions).

    3) All strategies are programmed to close ALL positions before session ends. There should be no open positions at the beggining of session.
    4) All of them have SyncAccountPosition = True and Wait until flat before executing live enabled.
    Your support team suggest me set SyncAccountPosition = false because with so many strategies compiting in the same instrument is not unusual to have orders problems. I tried but it was a mess and strategies made many wrong positions. However when SyncAccountPosition = True all strategies work fine but flash trade apppear.
    Is there any function like (firstbarofsession) or any code or configuration that could avoid that flash trade???
    Regards,
    Azunal
    Attached Files

    #2
    Hello azunal,

    Running so many strategies on one instrument is really not a good idea.

    I really really must stress this. You should make one strategy that has logic to keep many positions open.

    However, if you want to know which strategies are placing orders, print the order object to the output window in each script so that you can see the order states as the orders are placed.

    For example:
    protected override void OnOrderUpdate(IOrder order)
    {
    Print("strategyA | "+order.ToString());
    }

    If each strategy has a different print, you will be able to tell which strategies are submitting orders and which one this one is. (Possibly)


    How NinjaTrader will react to so many strategies all attempting to sync the account position I couldn't say. I would just say, don't do this.
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Hello Chelsea,

      Thanks for your answer. Unfortunately it won´t be easy to integrate all strategies in one logic. The thing is that running about 10 strategies in the same circunstances a couple of weeks ago does not make problems.

      How many strategies do you think that can be enable at the same time for each account? What I can do is enable manually only strategies that could trade next session it won´t be more than 2/3 for each account but all on the same instrument. Could it avoid that problems?.

      And just one more hesitation...If I add the code you mentioned I suppose I track every trade. I already named every entry considering strategies name. Is it the same?. Or tracking them using Iorder object would help me to debug and finally to skip flash trades somehow.

      Regards,

      Comment


        #4
        Hello azunal,

        I would not suggest even allowing 2 strategies to run on the same instrument on the same account.

        I suggest that you contact a Consultant and have them create a strategy at your request that incorporates these strategies together.

        The idea behind adding prints is to debug your code and understand what is happening. If you can find which strategy is sending the extra order, perhaps you can code into that strategy not to place that order.

        However, with the approach you taking, there is no good solution other than not taking this approach.

        Would like a list of professional NinjaScript Consultants who would be happy to create this strategy for you?
        Chelsea B.NinjaTrader Customer Service

        Comment


          #5
          Hello Chelsea,

          I get the point. Thank very much for your asnwers. I will debug and try to built strategy by myself. And of course, integrate as much as posible future strategies.

          Best regards,

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by r68cervera, Today, 05:29 AM
          0 responses
          2 views
          0 likes
          Last Post r68cervera  
          Started by geddyisodin, Today, 05:20 AM
          0 responses
          3 views
          0 likes
          Last Post geddyisodin  
          Started by JonesJoker, 04-22-2024, 12:23 PM
          6 responses
          34 views
          0 likes
          Last Post JonesJoker  
          Started by GussJ, 03-04-2020, 03:11 PM
          12 responses
          3,239 views
          0 likes
          Last Post Leafcutter  
          Started by AveryFlynn, Today, 04:57 AM
          0 responses
          6 views
          0 likes
          Last Post AveryFlynn  
          Working...
          X