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 Will not buy but will short only

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

    Strategy Will not buy but will short only

    I built a strategy and for the likes of me, the strategy will not buy but would only short. I have looked through the code, looked through the strategy, edited, removed conditions, rebuilt the sets, and still nothing. Yes I could rebuild the darn thing but that doesn't solve my problem and it will take a few hours. What troubleshooting techniques can I use to figure out why I can not buy but only short?

    Update: Okay created a simplified strategy, and it still wont execute a buy order. So I am assuming I am creating a long position in strategy builder wrong?
    Last edited by w0lverine; 02-03-2020, 07:31 PM. Reason: Update

    #2

    Comment


      #3
      Hello w0lverine,

      Thanks for your question.

      When debugging strategy logic, we recommend the following process:

      1. Test to reproduce the issue in the Playback Connection.
      2. Once you can reproduce, test the strategy with prints added so you can confirm your logic is allowing your order submission methods to be reached
      3. If the order submission method is reached but is not allowing order submissions, test again with Trace Orders enabled and check to see if the order method is getting ignored due to the internal rules of the Managed Approach.

      Debugging Tips - https://ninjatrader.com/support/help...script_cod.htm
      TraceOrders - https://ninjatrader.com/support/help...aceorders2.htm
      Debugging in the Strategy Builder - https://drive.google.com/file/d/1mTq...w?usp=drivesdk
      Playback Connection - https://ninjatrader.com/support/help...connection.htm
      Debugging Demo - https://drive.google.com/file/d/1rOz...w?usp=drivesdk

      Please also note that 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.) If the strategy calculates that is in a virtual position when it transitions to processing realtime data, the strategy's Start Behavior may waiting until this position becomes flat before orders are allowed to submit with realtime data. (Wait Until Flat.) You can observe the Strategies tab of the Control Center if the strategy is in a virtual position waiting to become flat. The strategy will be orange/yellow when waiting to for the historical position to be closed, and will be green when allowed to trade live.

      ImmediatelySubmit is used when we know the strategy position is where we want it and we want the strategy to resume this position. There can be cases where a strategy is enabled with ImmediatelySubmit and the strategy/account position are not in sync. In such a case the strategy may be closing open positions on the account when it is trying to open its own position.

      Synchronize Account is an additional function that will have NinjaTrader submit an order to sync the account to the strategy (not vice-versa.)

      If you would not like the strategy to start with a historical position, you can add the following to an unlocked strategy at the top of the OnBarUpdate method:

      if (State == State.Historical) return;

      Strategy Position vs. Account Position - https://ninjatrader.com/support/help..._account_p.htm
      Start Behaviors - https://ninjatrader.com/support/help..._positions.htm
      Managed Approach (Internal Rules) - https://ninjatrader.com/support/helpGuides/nt8/en-us/index.html?

      We look forward to being of further assistance.
      JimNinjaTrader Customer Service

      Comment


        #4
        I found out it was relating to an indicator issue. Thanks for these!

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by DavidHP, Today, 07:56 AM
        1 response
        5 views
        0 likes
        Last Post NinjaTrader_Erick  
        Started by kujista, Today, 06:23 AM
        3 responses
        8 views
        0 likes
        Last Post kujista
        by kujista
         
        Started by Mindset, Yesterday, 02:04 AM
        2 responses
        18 views
        0 likes
        Last Post NinjaTrader_RyanS  
        Started by f.saeidi, Today, 08:03 AM
        1 response
        5 views
        0 likes
        Last Post NinjaTrader_Jesse  
        Started by samish18, 04-17-2024, 08:57 AM
        15 responses
        53 views
        0 likes
        Last Post NinjaTrader_BrandonH  
        Working...
        X