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

Strategy extra entries

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

    Strategy extra entries

    I compiled a strategy on NT8 and I get extra orders. How can I check the cause?

    #2
    Click image for larger version

Name:	extra entries.jpg
Views:	186
Size:	68.3 KB
ID:	1119503 Here is a picture. I have oeder set for 2 entries and got 6?

    Comment


      #3
      Hello JTizz,

      Thanks for opening the thread.

      A strategy will place orders when your logic has allowed order submission methods to be reached. Understanding why your logic has allowed order submission methods to be reached requires taking debugging steps to review how your logic is executing.

      Also keep in mind, strategy positions are not the same as the account position. In your screenshot, we can see that the strategy closed two entries of one contract with a Profit target, and then entered twice with one contract on the next bar. Your account is 6 short though. You may check the Strategies tab of the Control Center to view the Strategy Position and the Account Position. I have included some educational information on Start Behaviors and Strategy/Account Position at the end of my post.

      Strategies tab - https://ninjatrader.com/support/help...eStrategiesTab

      If the strategy and the account are in sync, then it would seem that the strategy created a position of 6 short with its logic. You would want to then identify which trades have created that position and then take debugging steps to see why the strategy logic has allowed those trades to take place.

      Debugging Tips - https://ninjatrader.com/support/help...script_cod.htm

      Debugging in the Strategy Builder - https://drive.google.com/file/d/1mTq...w?usp=drivesdk

      Start Behavior education
      When a strategy is enabled, it processes historical data to determine trades that the strategy would have made on the data that is already on the PC/chart and to determine what position the strategy is in. (Strategy positions are separate from actual Account positions.)

      Wait Until Flat will wait until this virtual/historical position is closed before live orders can be submitted. It ensures that the strategy starts trading live from a flat position. If you enable the strategy when the account is flat, the strategy will waiting until this position calculated from historical data is closed so it is logically making trades starting from an entry signal.

      Immediately Submit automatically submits working orders from when the strategy processed historical data, and assumes the strategy position and account position are where you want it when you enable the strategy. This is typically used to have a strategy resume a position after disabling/enabling. If the strategy already had live orders running, the orders will resume with the new enablement of the strategy if they match the historically calculated orders. If the orders calculated from historical data do not match the live working orders, the live working orders will be cancelled and replaced by those calculated from historical data.

      Sync Account Positions is an additional option that has NinjaTrader submit an order to sync the account position to the position calculated by the strategy. (Not the other way around.)
      Adopt Account Position would be used if you want the strategy to inherit the Account Position on enablement. This requires additional programming.

      If you do not want the strategy to calculate a position from processing historical data. Simply add if (State == State.Historical) return; to the top of your strategy logic so historical processing is skipped. The strategy will then always start from a flat position because it has not calculated any orders.

      Strategy vs. Account Position — https://ninjatrader.com/support/help..._account_p.htm
      Start Behaviors — https://ninjatrader.com/support/help..._positions.htm
      We look forward to assisting.
      JimNinjaTrader Customer Service

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by gravdigaz6, Today, 11:40 PM
      0 responses
      2 views
      0 likes
      Last Post gravdigaz6  
      Started by MarianApalaghiei, Today, 10:49 PM
      3 responses
      9 views
      0 likes
      Last Post NinjaTrader_Manfred  
      Started by XXtrader, Today, 11:30 PM
      0 responses
      3 views
      0 likes
      Last Post XXtrader  
      Started by love2code2trade, Yesterday, 01:45 PM
      4 responses
      28 views
      0 likes
      Last Post love2code2trade  
      Started by funk10101, Today, 09:43 PM
      0 responses
      9 views
      0 likes
      Last Post funk10101  
      Working...
      X