No announcement yet.

Partner 728x90


Enter Short not working in Live Sim mode

  • Filter
  • Time
  • Show
Clear All
new posts

    Enter Short not working in Live Sim mode

    if (XXXXX == -1 && TradeShort )


    Works fine in Strategy Analyzer but trying to run the strategy in Live Sim mode it shows Exit Sell Short instead of Entry Sell Short in the execution log and never takes a short position.
    Any ideas would be helpful. I did not see any restrictions in the Sim account I created, has $10,000 starting cash.
    MNQ 09-20 Buy 1 12033.25 8/31/2020 11:34:20 AM b011b989ea974f4a94f81d7c46864f08 Entry 1 L 0e75cf34128b4ae8bc8bc567f1d71e29 Close position
    MNQ 09-20 Sell 1 12021.50 8/31/2020 11:33:45 AM 44e660e74792423d99d80dc0660e1736 Exit - c447ebf6b2694886965cd58f6ea83e53 Sell short
    MNQ 09-20 Sell 1 12021.25 8/31/2020 11:33:45 AM 19bdd58532534f6893dd0c020e93503b Exit 1 L 8c31f8d0a6174fdd98d000152afb7a24 Close position
    MNQ 09-20 Buy 1 12027.50 8/31/2020 11:33:34 AM 06a25a5b7b9649d8a681966a48ea4217 Entry 2 L 4ec3e56744d74b07b43de893018da640 Buy
    MNQ 09-20 Buy 1 12027.50 8/31/2020 11:33:34 AM 5606a21551204e29bd80935c1bfc6646 Entry 1 L 6fa2a58ba79e4bff85d9b2ae52af8fdf Close position

    Hello set2win,

    Thanks for your post.

    It sounds like the strategy and the account are out of sync. (The strategy calls EnterShort to place a sell market order, but the sell market order closes a position on the account instead of opening a new position.) I have included some information on strategy/account positions and how the strategy position is calculated at the end of my post.

    Also to note, if the strategy is in a long position and you call EnterShort, the strategy will submit 2 orders. One to close the position and another to open a new position in the opposite direction.

    Strategy vs. Account Position and Start Behavior info

    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 —

    Start Behaviors —

    We look forward to assisting.
    JimNinjaTrader Customer Service


      Thanks Jim for quick response. I changed Start Behavior to Immediately Submit Synchronize Account and all is better now.


      Latest Posts


      Topics Statistics Last Post
      Started by b16_aln, Today, 05:15 AM
      0 responses
      Last Post b16_aln
      by b16_aln
      Started by sidlercom80, Today, 04:57 AM
      0 responses
      Last Post sidlercom80  
      Started by patricia70, Today, 03:57 AM
      0 responses
      Last Post patricia70  
      Started by pjsmith, Today, 03:25 AM
      0 responses
      Last Post pjsmith
      by pjsmith
      Started by cincai, Today, 01:04 AM
      1 response
      Last Post NinjaTrader_Jason