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

Running Strategy in Real Time, Sim, and Market Replay

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

    Running Strategy in Real Time, Sim, and Market Replay

    Hello,

    So I developed some strategies and back test them and I like the results.

    Now I want to run the strategy in Market Replay and then Sim mode to compare against my back testing results.

    Few Questions:

    1. When I enable the strategy for Market Replay, Sim, or Real Time, I do not want the strategy to make a mistake trade any off any historical data that may be triggered.

    What do I need to add to the code to prevent historical data from triggering a trade and only use real time data?

    2. If I put Days To load to 0 (see attachment) will this solve step 1 concern?

    3. What does Max Bars Look Back and min bars required mean? Does min bars mean, make sure these many of bars are presented in real time before taking a trades? See attachment please.

    Ideally, I want the setup for testing to be similar to the setup settings when I do the back test. I will make sure to use same session template I use in back testing.

    Thanks for any help for this task.
    Attached Files
    Last edited by simple_goodoboy; 07-28-2017, 01:11 PM.

    #2
    Hello simple_goodoboy,

    To run your strategy only in real time, you could add the following to the top of your code,

    Code:
    if(State ==State.Historical) return;
    Please let us know if you need further assistance.
    Alan P.NinjaTrader Customer Service

    Comment


      #3
      Originally posted by NinjaTrader_AlanP View Post
      Hello simple_goodoboy,

      To run your strategy only in real time, you could add the following to the top of your code,

      Code:
      if(State ==State.Historical) return;
      Please let us know if you need further assistance.
      Thank you Alan,

      I assume I would not want to add this code if using Market Replay with the strategy, correct?

      Thank you,

      Comment


        #4
        Originally posted by NinjaTrader_AlanP View Post
        Hello simple_goodoboy,

        To run your strategy only in real time, you could add the following to the top of your code,

        Code:
        if(State ==State.Historical) return;
        Please let us know if you need further assistance.
        Thanks Alan,

        Regarding my other two questions in the original post:

        2. If I put Days To load to 0 (see attachment) will this solve step 1 concern?

        3. What does Max Bars Look Back and min bars required mean? Does min bars mean, make sure these many of bars are presented in real time before taking a trades? See attachment please.

        Thanks for your help, just learning

        Comment


          #5
          Hello simple_goodoboy,

          Could you please provide more information by what you mean a mistake trade? Could you provide some detail on what scenario you are concerned about which could arise from historical data?

          Maximum bars look back is explained at the following section of our helpguide,


          By Min Bars Required, are you referring to Bars Required to Trade? If so, it would be the amount of bars required before orders will be allowed to be submitted. If not, could you please provide more information?

          I look forward to your reply.
          Alan P.NinjaTrader Customer Service

          Comment


            #6
            Thank you Alan for responding.

            Sorry for the confusion.

            Could you please provide more information by what you mean a mistake trade? Could you provide some detail on what scenario you are concerned about which could arise from historical data?
            I am concerned that when I enable the strategy in real time, the strategy will execute trades from historical strategy setups.

            Maximum bars look back is explained at the following section of our helpguide,
            http://ninjatrader.com/support/helpG...rslookback.htm
            Does Maximum bars equal 256 means the strategy will start looking back at 256 bars to calculate its indicator values, or any variables in the strategy? I am not understanding what this means.

            By Min Bars Required, are you referring to Bars Required to Trade? If so, it would be the amount of bars required before orders will be allowed to be submitted. If not, could you please provide more information?
            So for example, if my session start time is 5pm, and Min Bars Required was equal to 20, my strategy will not start submitting orders til after the 20 bar, if the entry/exit condition was true?

            Thank you,
            Last edited by simple_goodoboy; 07-28-2017, 04:18 PM.

            Comment


              #7
              Hello Simple_goodoboy,

              To control the behavior of your strategy upon start up, you would want to read about start behavior at the following link,



              Maximum Bars Look Back will be how many bar values that will be stored in memory and accessible for reference. See the following section of our helpguide,



              Regarding BarsRequiredToTrade, this would be the amount of historical bars in the data series you’ll need before the strategy starts executing trades. Say for example you were trading snapchap on a 5Min chart the day of the IPO, with BarsRequiredToTrade=10, 50 minutes would need to pass before the strategy start processing order calls.

              See,


              Please let us know if you need further assistance.
              Alan P.NinjaTrader Customer Service

              Comment


                #8
                Originally posted by NinjaTrader_AlanP View Post
                Hello Simple_goodoboy,

                To control the behavior of your strategy upon start up, you would want to read about start behavior at the following link,



                Maximum Bars Look Back will be how many bar values that will be stored in memory and accessible for reference. See the following section of our helpguide,



                Regarding BarsRequiredToTrade, this would be the amount of historical bars in the data series you’ll need before the strategy starts executing trades. Say for example you were trading snapchap on a 5Min chart the day of the IPO, with BarsRequiredToTrade=10, 50 minutes would need to pass before the strategy start processing order calls.

                See,


                Please let us know if you need further assistance.

                Thank you so much Alan

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by timmbbo, 07-05-2023, 10:21 PM
                3 responses
                150 views
                0 likes
                Last Post grayfrog  
                Started by Lumbeezl, 01-11-2022, 06:50 PM
                30 responses
                804 views
                1 like
                Last Post grayfrog  
                Started by xiinteractive, 04-09-2024, 08:08 AM
                3 responses
                11 views
                0 likes
                Last Post NinjaTrader_Erick  
                Started by Johnny Santiago, 10-11-2019, 09:21 AM
                95 responses
                6,194 views
                0 likes
                Last Post xiinteractive  
                Started by Irukandji, Today, 09:34 AM
                1 response
                3 views
                0 likes
                Last Post NinjaTrader_Clayton  
                Working...
                X