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 Max238, Today, 01:28 AM
          1 response
          22 views
          0 likes
          Last Post CactusMan  
          Started by giulyko00, Yesterday, 12:03 PM
          2 responses
          10 views
          0 likes
          Last Post giulyko00  
          Started by r68cervera, Today, 05:29 AM
          0 responses
          4 views
          0 likes
          Last Post r68cervera  
          Started by geddyisodin, Today, 05:20 AM
          0 responses
          6 views
          0 likes
          Last Post geddyisodin  
          Started by JonesJoker, 04-22-2024, 12:23 PM
          6 responses
          38 views
          0 likes
          Last Post JonesJoker  
          Working...
          X