Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Manual sync of strategy and account

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

    Manual sync of strategy and account

    I have read through the posts and docs regarding the nuances of syncing (or not) strategies with account positions. In this post from NinjaTrader_Josh he talks about syncing strategy and accounts manually.
    http://www.ninjatrader.com/support/f...ead.php?t=4033
    this post was referred to by NinjaTrader_Brett here and presented as a separate option (Option 3) than automatic syncing (Option 4):
    http://www.ninjatrader.com/support/f...ht=manual+sync

    My situation: I have long running strategies that use historical data. When starting strategies there are times that I would like to immediately enter an existing virtual trade, but other times when I want to let the strategy go flat first. I am assuming that there is a way to use both approaches and that it may involve manually entering orders and then syncing them to the strategy (maybe I am totally wrong).

    If it does involve manually syncing then would it be possible to get the official NT step by step instructions as to the procedure to sync a strategy and account by placing a manual order? For instance:

    1) Identify instrument order quantity of active historical virtual trade
    2) Place manual trade for this instrument with the exact quantity as the historical virtual trade
    3) Enable Immediately Submit Live Working Orders option
    4) Select Synch Account Position in strategy options
    5) Enable strategy
    6) Disable Immediately Submit Live Working Orders option (enable Wait Until Flat) after syncing complete so that the next enabled strategy waits until flat.

    Thanks

    #2
    joesandyego,

    I am not sure exactly what you mean. Could you please clarify?

    Are you trying to have the strategy manage existing manual trades? Are you only attempting for your strategy to have access to historical trade information?

    Why do you need to enter a manual trade and then enter a virtual one?

    My intuition tells me you could simple create your strategy with a boolean flag, set it to true if you want it to wait until flat, or set it to false if you want it to immediately enter a trade.
    Adam P.NinjaTrader Customer Service

    Comment


      #3
      Hi,
      No, I am not wanting it to manage existing manual trades. I went down that path since it seemed like it may solve my problem. Here is the description of my problem without talking about manual trades:

      My situation: I have long running strategies (could run for months) that use historical data. When starting strategies there are times that I would like to immediately enter the current virtual trade, but other times when I want to let the strategy go flat first. I am assuming that there is a way to use both approaches.

      If this can be done with a bool then great. I already use MarketPositon.Flat as a requirement before entering a trade. I actually check for Flat before running most of my code since it is wasted CPU if there is no trade to be placed by definition due to my requirement of Flat condition.

      Let me know your thoughts. Maybe I will have to rethink how I use MarketPosition based on your feedback.

      Thanks

      Comment


        #4
        @joesandyego

        you might just use my running strategy parameters editor. You can integrate it easily into your strategy.

        In your strategy you define a bool paramter _allowentry. And then you turn this flag on or off in your strategy while it is running.

        http://www.zweisteintrading.eu/strat...ersruntime.htm

        best regards

        Andreas

        P.S. You can also handle manual syncing with this tool, just add another parameter _enterinposition.

        Comment


          #5
          joesandyego,

          I am suggesting something like the following :

          if ( Position.MarketPosition == MarketPosition.Flat && trade_flag)
          {
          //enter long or whatever order control you need
          }
          else
          {
          //manage the virtual trade
          }

          Im still a little unsure what your virtual trade is for, so if you could clarify I could offer better advice.
          Adam P.NinjaTrader Customer Service

          Comment


            #6
            Hi,
            Sorry if I am not using clear terminology. When I start/enable my strategy today, it uses 100+ days of historical data. During that historical time period the strategy enters a trade (historical trade) and therefore the strategy is not Flat today. With instrument A I want to enter that historical trade immediately even though it is not flat. But with instrument B (running a different instance of the strategy) I want to wait until the strategy is flat before allowing it to enter any real trades.

            A good example is an simple SMA cross strategy where each instrument is running on its own separate strategy instance (e.g. this is not a multi-instrument strategy). If instrument A just crossed yesterday then I may want to enter that historical trade immediately (make a real trade) even though the cross happened yesterday. If instrument B crossed 30 days ago then I may want to wait until the strategy is flat since instrument B may be at the end of the trend detected by the SMA cross.

            I do not know if the MarketPosition.Flat && bool gets me what I need since in the end I believe that everything is dictated by the "Immediately submit live working historical orders" option. But I do not want to immediately submit all live historical working orders, I want to be able to choose to enter an active historical trade immediately on a case by case basis for each instance of my strategies. Also, using the MarketPosition.Flat && bool, creates the issue that I need to always have all strategies use historical data and enter historical trades so that I can determine if I should enter immediately or wait until flat, and if I set the bool to false then it won't enter the historical trades.

            Is there a programmable option for "Immediately submit live working orders"?

            Not sure if I made this any clearer.... I feel as though I must be missing something obvious.

            Comment


              #7
              joesandyego,

              You could enter a market order in whatever direction you want based on a historical trade.

              What I suggested is that ahead of time you can set your boolean as a switch to either A) wait until flat before its allowed to enter an order or B) do something else.

              In your case, the "do something else" is to check the last order and whatever other conditions you want (such as the last order's position) and then submit a market order I believe.

              You just decide ahead of time before activating your strategy whether or not you want it to wait until flat, or look back through previous trades and/or indicator values, perform some logic and then make a decision.

              Whatever your decision is determines if you choose "True" for the boolean value, or "false".
              Adam P.NinjaTrader Customer Service

              Comment


                #8
                Hi,
                OK. I think that I am getting closer to understanding. But my last (mis)understanding is as follows:
                When I enable/start my strategy, if I would like my NT strategy to place a real order (so that the strategy can manage the real position) and that real order is based on an active historical live trade then I would have to select Immediately submit live working historical orders, I know how to do this. And, yes, I see your point that I could know ahead of time whether or not I want to do this based on, for instance, using strategy analyzer.

                So then maybe this is as simple as a timing/steps question. Can I select the "Immediately submit live working historical orders" option then enable some strategies which would then create real trades immediately (if they were not flat). After those real trades are made then I select "Wait Until Flat" and enable those strategies that I want to wait until flat. When I select "Wait Until Flat" would it go back and exit the real trades that were made based on historical trades? I hope not....

                Is it this easy?

                Best.

                Comment


                  #9
                  Originally posted by joesandyego View Post
                  Hi,
                  When I enable/start my strategy, if I would like my NT strategy to place a real order (so that the strategy can manage the real position) and that real order is based on an active historical live trade then I would have to select Immediately submit live working historical orders, I know how to do this.
                  I am not sure I understand. This sounds like you want it to manage a historical trade, or do you want it to close the historical trade and then submit a market order in the same direction? Are these historical trades simulated trades or live trades that are currently active?

                  Can I select the "Immediately submit live working historical orders" option then enable some strategies which would then create real trades immediately (if they were not flat). After those real trades are made then I select "Wait Until Flat" and enable those strategies that I want to wait until flat. When I select "Wait Until Flat" would it go back and exit the real trades that were made based on historical trades?
                  All of this would have to be decided ahead of time. I.e. you couldn't change what you want the strategy to do after you activate it. I am not sure if zweistein's modification allows you to change this on the fly, perhaps he can comment. I believe this was his intention, i.e. to point out that his code does allow you to change something on the fly.

                  I suggested using the boolean to pick at the start up of the strategy, whether you want it to wait until flat, or to submit a live order. Its a simple boolean flag toggle. E.g. if true, wait until flat, if false, check to see if it can submit an order immediately on startup.

                  Please let me know if I may assist further.
                  Adam P.NinjaTrader Customer Service

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by MonteK, Yesterday, 09:31 PM
                  0 responses
                  25 views
                  0 likes
                  Last Post MonteK
                  by MonteK
                   
                  Started by nkhoi, Yesterday, 09:27 PM
                  1 response
                  11 views
                  0 likes
                  Last Post NinjaTrader_ChelseaB  
                  Started by SuperDude123, Yesterday, 03:52 PM
                  4 responses
                  26 views
                  0 likes
                  Last Post NinjaTrader_ChelseaB  
                  Started by ErikY, Yesterday, 01:16 PM
                  1 response
                  25 views
                  0 likes
                  Last Post NinjaTrader_ChelseaB  
                  Started by BullyWig Trader, Yesterday, 12:42 PM
                  1 response
                  17 views
                  0 likes
                  Last Post NinjaTrader_ChelseaB  
                  Working...
                  X