Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Multiple strategies for the same instrument

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

    Multiple strategies for the same instrument

    I'm running several strategies on the same instrument in parallel, and have a few questions:
    1. Can I filter the markers on the real-time chart so only executions from one of the strategies are visible?
    2. Can I use "Sync account position = true"? What will happen if I don't start the strategies at the same time?


    BTW, on a different matter - how can I see the target and stop orders in the chart?

    Thanks,
    Boaz

    #2
    Hello,

    Thanks for the note.

    You would need to use two charts to separate out the markers. As far as the sync option this would not be advised. As then you will run into an issue where the strategies will butt heads with each other.

    For example. Strategy A wants to be short strategy B long. They would both try to sync your already existing flat position. Resulting ina a flat position and a trade that just caused some commissions.You would want to sync these sstrategies manually most likely be checking the strategy positions when you start and synving your account as needed.

    Let me know if I can be of further assistance.

    Comment


      #3
      Thanks Brett.
      However, this doesn't make sense to me. Say I use the suggested configuration, and that one of my strategies decides that it has a 1-contract long position, which was filled 2 hours before I started NT.
      Am I expected to manually place a market buy order just to make my account position and strategy position the same?
      What if market conditions have changed dramatically in those two hours?

      For example, the strategy thinks the long position was filled with an average price of 1.4000, and the PT is 1.4010. Say the price now is at 1.4009. If I put a market order, and regard slippage and commissions, I'm loosing money!

      Isn't there a way to tell NT to just start running (without waiting the strategy to go flat), and disregard any open positions and orders? Namely, I would like to force NT into thinking the account and strategy are in sync, that it must not open any positions based on historical data, and to run from the current time.

      Thanks,

      Boaz

      Comment


        #4
        Hello,

        Yes this is how it works by default.

        However you will run into issues when the strategy tries to close out that open position it had earlier that didnt get placed into the live account sicne the strategy was not running.

        ->Strategy goes long yesterday in historical
        ->Account position is flat
        ->Strategy Position is long 1.
        ->Strategy then is running today.

        -If out of sync
        ->Strategy will try to close the long 1 position is was in from yesterday.
        ->Strategy will send order to short 1 contract to get you out of your position.
        ->This results is account position now being short 1 contract
        ->Unexpected position since strategy and account are running out of sync.

        This is why you must manually sync the strategy and account. Otherwise you need to use the setting to not submit orders until the strategy is flat.

        Let me know if I can be of further assistance.

        Comment


          #5
          Brett,
          I recognize the importance of having the strategy and account in sync. However, if anyone should change their position manually it is NT which has virtual positions, not the live account which has real ones.
          I don't mind having a report in NT saying I lost a bunch of virtual dollars. I do, however, very much mind losing real ones.

          I would have expected a way of telling NT "Hey, this position you think is open has been automagically closed by the user - please simulate a market order and be done with it".

          It seems weird that I have to change reality in order to match a simulator, and not the other way around.

          Boaz

          Comment


            #6
            Your NinjaScript strategy will always work exactly as you coded it and will submit orders exactly as coded.

            The position of the strategy does not relate at all to the strategy in the account.

            Its up to you to manually sync these when your ready to run your strategy.

            Please let me know if there is anything else I can clear up for you.

            Comment


              #7
              Thanks Brett.
              A couple of questions:
              1. How can I know the position of the startegy before I run it?
              2. Is there a way to manually sync the strategy, and not my account, for example by forcing a market order via NT's control panel?

              Comment


                #8
                Hi Brett,
                and thanks for your answers.
                A couple more things:[List][*]Is there a way to signal the strategy to close the position from the control center? Maybe using some special code in the script?[*]How can I tell what position my strategy thinks it has before running it?
                [\List]

                Boaz

                Comment


                  #9
                  Hello,

                  Unfortunately not possible on all the below. NinjaScript strategies are not designed to do this for a specific reason.

                  Reason is that live results would be completely different then backtest/historical results since your able to add in dynamic variables in run time that can't be backtested. Therefor the strategy needs to be coded to run the same on historical as it does live. This is for consistency.

                  Let me know if I can be of further assistance.

                  Comment


                    #10
                    Hi Boaz,
                    To close a virtual position in a strategy when you go live is very easy.
                    1. Record the computer time (now) the strategy starts.
                    2. On first bar that time[0]>recorded time and in position -> close.

                    Baruch

                    Comment


                      #11
                      Thanks Baruch,
                      but won't that send a real market order?

                      Comment


                        #12
                        You're right. It should be Time[0].Addminutes(- BarsPeriod.Value) > start time. This will work for minute bars, for other types need to improvise.

                        Comment


                          #13
                          Great solution. Thanks.

                          Comment

                          Latest Posts

                          Collapse

                          Topics Statistics Last Post
                          Started by rocketman7, Today, 01:00 AM
                          0 responses
                          1 view
                          0 likes
                          Last Post rocketman7  
                          Started by wzgy0920, 04-20-2024, 06:09 PM
                          2 responses
                          27 views
                          0 likes
                          Last Post wzgy0920  
                          Started by wzgy0920, 02-22-2024, 01:11 AM
                          5 responses
                          32 views
                          0 likes
                          Last Post wzgy0920  
                          Started by wzgy0920, 04-23-2024, 09:53 PM
                          2 responses
                          74 views
                          0 likes
                          Last Post wzgy0920  
                          Started by Kensonprib, 04-28-2021, 10:11 AM
                          5 responses
                          193 views
                          0 likes
                          Last Post Hasadafa  
                          Working...
                          X