Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

Closed position manually and Strategy stuck now

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

    Closed position manually and Strategy stuck now

    So my strategy is working good and taking entries and closing itself like it is supposed to do. The problem is that I closed a trade manually and now the strategy is in Limbo because it thinks the trade is still open. Due to this, it will not take another trade because it is set to wait for flat.

    How do I clear this up so it trades again?

    I have tried everything including uninstall and reinstall and it is stuck.

    #2
    Hello casabella,

    Thanks for your post.

    Most strategies are intended to run without other trades occurring on the same instrument/account. By closing the account position (" I closed a trade manually ") the strategy would be out of sync with its virtual position and account position. The strategy will maintain its virtual position so while the account position is flat when the strategy reaches its next exit point (stoploss or profit target) it would have placed a real trade and instead of being flat you would have been in a position and still out of sync and the strategy would continue this way. As you can imagine this would not be desirable.

    Since you have stopped and restarted NinjaTrader, that is no longer the case. Now the strategy is following your direction to wait until it is flat before placing live trades and then it will be in sync. When you apply the strategy, it will perform historical trades according to your logic and according to the screenshot, the last historical trade was 1 short. Once the strategy reaches it's stop or profit target the last historical trade will then be flat, the account position will be flat, the strategy name will turn green and live trades will begin.

    If you want to manually interact with a strategy, you may want to consider using another type of strategy that is designed for manual interactions. An example of this exists in your NinjaTrader and is called SampleATMstrategy where it will place a trade and then an ATM strategy will take care of the profit and stop. You can interact with the active strategy when it is in position and can adjust the stops/targets manually if you wish. Once the position is closed, the strategy then resumes looking for the next entry. This type of strategy uses special Ninjascript methods to connect the strategy to an ATM, these methods can be found here: https://ninjatrader.com/support/help...gy_methods.htm



    Paul H.NinjaTrader Customer Service

    Comment


      #3
      Hello,
      The problem casabella described back in 2014 can be applied today. Often when I start a strategy I built in strategy builder in the middle of a trading session, there is an “Strategy Position” or “Virtual Position” already open, so when I start my strategy, it will not trade until the running “Strategy Position” closes after the stop loss or profit target is reached, which could be hours. The strategy is orange on the strategy tab.

      How can I close any running “Strategy or Virtual Positions” when I start a strategy so it will start placing trades based on the strategy theory, I have built in and not wait for any “Strategy or Virtual Positions” to close?

      I have read and tried the options outlined in "Start Behavior". No option seems to address this problem?

      Thanks,
      Joe


      Comment


        #4
        Hello jpatri,

        Thanks for your post.

        The original poster issue was caused by manually trading on the same instrument as a strategy was currently running.

        What I think you are describing is a normal occurrence of a strategy that has performed historical trades and is waiting for the last performed historical trade to complete before entering live trades.

        If you want your strategy builder created strategy to begin performing live trades according to your logic you can have the strategy bypass performing historical trades.

        In each entry Set, you would add the condition (left to right) Misc>Current state, Equals, Misc>state - Realtime.

        This condition will prevent the strategy from performing any historical trades and it will begin performing live trades as your strategy conditions become true.

        Please note that this condition would also prevent the strategy from performing historical trades in the strategy analyzer.

        Paul H.NinjaTrader Customer Service

        Comment


          #5
          PaulH,
          Your: Misc>Current state, Equals, Misc>state - Realtime works perfectly, thank you!!
          Joe P.

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by ScottWalsh, Today, 06:52 PM
          4 responses
          32 views
          0 likes
          Last Post ScottWalsh  
          Started by olisav57, Today, 07:39 PM
          0 responses
          4 views
          0 likes
          Last Post olisav57  
          Started by trilliantrader, Today, 03:01 PM
          2 responses
          19 views
          0 likes
          Last Post helpwanted  
          Started by cre8able, Today, 07:24 PM
          0 responses
          6 views
          0 likes
          Last Post cre8able  
          Started by Haiasi, Today, 06:53 PM
          1 response
          5 views
          0 likes
          Last Post NinjaTrader_Manfred  
          Working...
          X