• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Manage account position vs strategy

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

    Manage account position vs strategy

    Hi Support team

    Please i need help to manage my account position, I designed a strategy builder with the simple stochastic crossover with profit and stop. The problem I have is that I activate the strategy in a 5-minute chart and it works perfect, at the end of the day I close ninjatrader, The next day when I activate the strategy again I can't find the way to keep my account position and stop orders and profit of the previous day.

    I have configured in the four ways that they have available, and none works for me, somehow they send me market orders to synchronize, cancel the stop orders and profit. Inmediately submit is the one that works best but when activate the stop or the profit then add the activated quantity to the account position.

    What should I do, I need to configure it with programming or I have to configure something that I still don't know.

    I need is simple, my account position stays the same when I am going to trade the next day, I do not want to change the stops and profit orders from the previous day.

    Thanks

    #2
    Hello walter739,

    Welcome to the NinjaTrader forums!

    For a strategy position and orders to be resumed intra-bar granularity, (possibly TickReplay), and the StartBehavior.ImmediatelySubmit is needed.

    The strategy will need to be unlocked to add the 1 tick intra-bar granularity by hand.

    Below is a link to a forum post that details what is needed.
    http://ninjatrader.com/support/forum...332#post499332
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Hello ChelseaB, thanks for your time

      Put the strategy in tick replay and it affects me the operation, it has much more false entries than before.

      I have been reading the link sent to me yesterday and looking for alternatives, but I still don't have the ideal.

      With StartBehavior.ImmediatelySubmit I am doing well, the problem I have is that when I activate for the first time if there are positions in the history of the strategy then it activates a profit and a stoploss without taking into account position, how can I do so that it does not activate me the profit and stoploss when activating the strategy?

      Thank you

      Comment


        #4
        Hello walter739,

        When using TickReplay are you wanting the logic to only be evaluated when the bar closes?

        In the conditions that take actions include IsFirstTickOfBar == true.
        https://ninjatrader.com/support/help...ttickofbar.htm

        Are you only wanting actions when the primary series is updating?

        In the conditions that take actions include BarsInProgress == 0.
        https://ninjatrader.com/support/help...inprogress.htm


        If you want to start flat, exit a position on the last historical bar, or don't place orders historically.

        Below is a link to a post that demonstrates.
        https://ninjatrader.com/support/foru...541#post811541

        If you want the strategy and account to be out of sync but no stop and target placed, remove the code from the script that places the stop loss and profit target.

        Or you can use the immediately submit synchronize account start behavior and synchronize the account.
        Chelsea B.NinjaTrader Customer Service

        Comment


          #5
          Hello, Chelsea,

          Thanks for your time. I appreciated it.

          I wish not use tickreplay, My strategy is swing with stocks, I need run backtest, If i use tick replay for backtest for months, I need lot of time for download the information.

          With StartBehavior.ImmediatelySubmit I am doing well, the problem I have is that when I activate for the first time if there are positions in the history of the strategy then it activates a profit and a stoploss without taking into account position, how can I do so that it does not activate me the profit and stoploss when activating the strategy?

          For solved these i use
          if (State == State.Historical) return; But i think it not is in the correct position. I send the picture, please if you can help me.

          Regards

          Comment


            #6
            Hello walter739,

            Are you finding my suggestions in post #4 about how to start without the stoploss and profit target are not helpful for this question?


            To prevent historical data from being processed, the if (State == State.Historical) return; must be the first line in OnBarUpdate(). OnBarUpdate() is the method that is processing the logic for each bar that you are trying to suppress.

            It looks like in your script you've added this to OnStateChange(). Move this to the top of OnBarUpdate().
            Chelsea B.NinjaTrader Customer Service

            Comment


              #7
              Hello Chelsea, thanks for answer.

              Your suggestions about cancel stop and profit in the script, is not good for me, the stop and profit is part of the strategy.

              I put the code if (State == State.Historical) return, in the right place, with StartBehavior.ImmediatelySubmit ,thanks, work fine but still cancel my orders the profit and target pending.

              I try describe what i need:

              I buy 100 SKX , with StartBehavior.ImmediatelySubmit in my strategy, i have 100 SKX in my possition account and strategy, and order stop and profit, at end of day i turn off ninjatrader,

              The next day i enable again the strategy before open market, I need in the open first bar 9:31 active the profit or the stop if the strategy change in the after hours o before open market., if not have changes in strategy the aftermarket i need still active stop and profit.

              I read so much, for try solved, but i not believe that it is impossible, Sorry if i insist, but i need try solve these.

              Thanks for your time and suggestions.

              Regards

              Comment


                #8
                Hello walter739,

                In post #3 you are asking how to prevent the stop loss and profit target from being submitted, is this correct?

                Originally posted by walter739 View Post
                how can I do so that it does not activate me the profit and stoploss when activating the strategy?

                Are you wanting to prevent a stop loss and profit target from being submitted when the strategy is enabled?

                Or are you trying to resume a strategy and resume the existing stop loss and profit target that was placed when the strategy was previously enabled?
                Chelsea B.NinjaTrader Customer Service

                Comment


                  #9
                  Sorry for my english, i must write, how can I do so that it does not cancel me the profit and stoploss when activating the strategy?

                  I try resume a strategy and resume the existing stop loss and profit target that was placed when the strategy was previously enabled? Yes exactly

                  Thank for your help

                  Regards

                  Comment


                    #10
                    Hello walter739,

                    For a strategy to resume with the same position and working orders, the script must have orders submitted to a 1 tick intra-bar granularity series with TickReplay enabled, and the Start Behavior set to ImmediatelySubmit.

                    This allows the script to resume when re-enabled (if there has been no data received after the script was disabled or if the data received after the script was disabled has not changed the position).

                    May I confirm you have reviewed the link about resume a strategy and previously placed strategy orders in post #2?
                    Chelsea B.NinjaTrader Customer Service

                    Comment


                      #11
                      Hello ChelseaB, thanks for answer.

                      I have market data for IB, I see in other posts, TIck replay dont work with IB.

                      My strategy is swing in minutes , I can write some code for a strategy to resume with the same position and working orders with minutes ?

                      Regards

                      Comment


                        #12
                        Hello walter739,

                        Without tick data, orders and positions may not be the same when restarting the script. This may cause positions and orders to be out of sync with the account. For any orders that do not match NinjaTrader will cancel those orders.

                        From the help guide:
                        "Any active orders on the account previously generated by the strategy that does not match* an active strategy order will be cancelled. Should the strategy be unable to cancel and receive confirmation on the cancellation of these orders within 40 seconds the strategy will not start and an alert will be issued.
                        * A previously generated order is considered to match an active strategy order when the order action, order type, quantity, limit price, and stop price are exactly identical."

                        https://ninjatrader.com/support/help...ediatelySubmit

                        If you would like a strategy to resume and calculate the same orders and positions historically, you may want to consider supplementing the Interactive Brokers data with a subscription to Kinetick or IQFeed which includes historical tick data.

                        Below is a link to the NinjaTrader 8 help guide on Data by provider which shows the supported connection technologies and the types of data these connections support.
                        http://ninjatrader.com/support/helpG...y_provider.htm
                        Chelsea B.NinjaTrader Customer Service

                        Comment


                          #13
                          I understand, thanks for your time. First i will build my strategy and after try with kinetick.

                          Regards

                          Comment

                          Latest Posts

                          Collapse

                          Topics Statistics Last Post
                          Started by MARTIN MARTIN, Yesterday, 01:01 PM
                          3 responses
                          39 views
                          0 likes
                          Last Post MARTIN MARTIN  
                          Started by NickyD, Today, 11:42 AM
                          1 response
                          9 views
                          0 likes
                          Last Post NinjaTrader_Jim  
                          Started by cupir2, Today, 11:25 AM
                          3 responses
                          15 views
                          0 likes
                          Last Post NinjaTrader_Jesse  
                          Started by 7robert, Today, 11:15 AM
                          2 responses
                          7 views
                          0 likes
                          Last Post 7robert
                          by 7robert
                           
                          Started by meandthetrio, Today, 10:52 AM
                          0 responses
                          11 views
                          0 likes
                          Last Post meandthetrio  
                          Working...
                          X