Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Enter Short not working in Live Sim mode

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

    Enter Short not working in Live Sim mode

    if (XXXXX == -1 && TradeShort )

    {
    EnterShort(Contracts);
    }

    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

    #2
    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 — 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


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

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by stafe, Today, 10:43 AM
      0 responses
      7 views
      0 likes
      Last Post stafe
      by stafe
       
      Started by UltraNIX, Today, 09:13 AM
      1 response
      10 views
      0 likes
      Last Post NinjaTrader_ChrisL  
      Started by Tuxstuff215, Today, 06:32 AM
      1 response
      15 views
      0 likes
      Last Post NinjaTrader_ChrisL  
      Started by carlot, Today, 08:10 AM
      1 response
      20 views
      0 likes
      Last Post NinjaTrader_ChrisL  
      Started by KirkHammett, Yesterday, 11:15 PM
      1 response
      16 views
      0 likes
      Last Post NinjaTrader_ChrisL  
      Working...
      X