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.
    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.


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

        In the conditions that take actions include BarsInProgress == 0.



        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.


        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."



                        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.
                        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 ScottWalsh, 04-16-2024, 04:29 PM
                          6 responses
                          27 views
                          0 likes
                          Last Post ScottWalsh  
                          Started by frankthearm, Today, 09:08 AM
                          10 responses
                          35 views
                          0 likes
                          Last Post frankthearm  
                          Started by GwFutures1988, Today, 02:48 PM
                          0 responses
                          2 views
                          0 likes
                          Last Post GwFutures1988  
                          Started by mmenigma, Today, 02:22 PM
                          1 response
                          3 views
                          0 likes
                          Last Post NinjaTrader_Jesse  
                          Started by NRITV, Today, 01:15 PM
                          2 responses
                          9 views
                          0 likes
                          Last Post NRITV
                          by NRITV
                           
                          Working...
                          X