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

Execution only algo

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

    Execution only algo

    Hi there Ninja community

    I have an algo i made in the ninja trader strategy builder. I am trying to use it to execute my orders for me. its not a profitable strategy just a tool for executing orders. My problem is when i run it live it has virtual positions already open. How can i reset it so it starts trading for real again? other wise i have to wait for the virtual positions to clear which could take forever.

    Thanks in advance for any help
    Jack.

    #2
    Hello jmahon,

    Thanks for your post.

    In NinjaTrader8, to prevent the historical data/trades from being processed you can have the code "return" if it processing historical data.

    In OnBarUpdate() you can add:

    if (State == State.Historical) return; // do not process your code below this line if historical

    Please note that this means you would not be able to run backtests in the strategy analyzer. You may want to create a user input that allows you to turn on or off historical trades by enabling (or not) the above code line.

    Reference: https://ninjatrader.com/support/help...nt8/?state.htm
    Paul H.NinjaTrader Customer Service

    Comment


      #3
      Originally posted by NinjaTrader_PaulH View Post
      Hello jmahon,

      Thanks for your post.

      In NinjaTrader8, to prevent the historical data/trades from being processed you can have the code "return" if it processing historical data.

      In OnBarUpdate() you can add:

      if (State == State.Historical) return; // do not process your code below this line if historical

      Please note that this means you would not be able to run backtests in the strategy analyzer. You may want to create a user input that allows you to turn on or off historical trades by enabling (or not) the above code line.

      Reference: https://ninjatrader.com/support/help...nt8/?state.htm
      Thanks for your help Paul, so this cannot be done in the strategy builder? I have to unlock the code?

      Comment


        #4
        Hello jmahon,

        Thanks for your reply.

        Sorry, I missed that you were using the Strategy Builder.

        Yes, you can do something similar by creating the condition (in each entry set) Left side Misc>Current state, center Equals, right side Misc>State>Real time
        Paul H.NinjaTrader Customer Service

        Comment


          #5
          Originally posted by NinjaTrader_PaulH View Post
          Hello jmahon,

          Thanks for your reply.

          Sorry, I missed that you were using the Strategy Builder.

          Yes, you can do something similar by creating the condition (in each entry set) Left side Misc>Current state, center Equals, right side Misc>State>Real time
          Amazing! thank you very much Paul

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by andrewtrades, Today, 04:57 PM
          1 response
          8 views
          0 likes
          Last Post NinjaTrader_Manfred  
          Started by chbruno, Today, 04:10 PM
          0 responses
          6 views
          0 likes
          Last Post chbruno
          by chbruno
           
          Started by josh18955, 03-25-2023, 11:16 AM
          6 responses
          436 views
          0 likes
          Last Post Delerium  
          Started by FAQtrader, Today, 03:35 PM
          0 responses
          7 views
          0 likes
          Last Post FAQtrader  
          Started by rocketman7, Today, 09:41 AM
          5 responses
          19 views
          0 likes
          Last Post NinjaTrader_Jesse  
          Working...
          X