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

Multi-Time Frame

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

    Multi-Time Frame

    Hello all,

    In order to enhance results of the 1 minute strategy I wanted it to run also in 2 minute period with the same instrument. To make it in one script I put this row there (in bold):

    … IsInstantiatedOnEachOptimizationIteration = true;
    }
    else if (State == State.Configure)
    {
    SetStopLoss("", CalculationMode.Ticks, 8, false);
    SetProfitTarget("", CalculationMode.Ticks, 2);
    AddDataSeries(Data.BarsPeriodType.Minute, 2);

    }
    else if (State == State.DataLoaded)
    {

    Obviously was not enough. What did I miss?
    Thank you for help
    Michael

    #2
    Hello Michael,

    If your primary interval is 1 minute, then OnBarUpdate is also going to be triggering every 2 minutes as well.

    You could change your logic to trigger actions every other bar if you wanted to and no added series would be necessary.

    When you mention "Obviously was not enough. " what is the behavior you are expecting?

    What is the behavior you experienced?

    What is the issue you are having?
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Hello Chelsea B.
      Thank oyu for respond.
      I've got results of 1 minute interval strategy performans on 'Strategy Analizer'; than added that row. and got the same results.

      Comment


        #4
        I've expected different amount of trades after adding that row

        Comment


          #5
          Hello Michael,

          Adding a 2 minute series when the primary series is 1 minute would cause OnBarUpdate to updated every 1 minute and also every 2 minutes.

          Since its already updating every 1 minute, it would already be updating every 2 minutes as well. So it is already updating every 2 minutes and the behavior wouldn't change.

          Are you trying to have the logic that places orders evaluate only when the 2 minute series is processing and not every minute?

          Use the BarsInProgress property to run code only when a specific series is processing.
          Below is a public link to the help guide.
          Chelsea B.NinjaTrader Customer Service

          Comment


            #6
            Let me ask it this way. I have a strategy that runs on I minute interval. An addition to that I want the same strategy to run on 2 minute interval so I’ll get more situations when conditions are met and trade is available, so eventually it will be more trades. Now, the question is: is it possible to write this in one script? I thought using Multi-Time frame?

            Comment


              #7
              Hello Michael,

              I'm still understanding.

              If OnBarUpdate is running every 1 one, then its also running every 2 minutes.

              Its already running every 2 minutes.

              Adding 2 minutes series isn't going to change anything because its already running every 2 minutes.

              Are you trying to prevent it from running every 1 minute and have it only run every 2 minutes?
              Chelsea B.NinjaTrader Customer Service

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by alexstox, 10-16-2018, 03:29 PM
              11 responses
              344 views
              0 likes
              Last Post aligator  
              Started by ageeholdings, 05-01-2024, 05:22 AM
              6 responses
              44 views
              0 likes
              Last Post ageeholdings  
              Started by tony_28217, Today, 07:04 PM
              0 responses
              11 views
              0 likes
              Last Post tony_28217  
              Started by flybuzz, Today, 10:33 AM
              1 response
              9 views
              0 likes
              Last Post flybuzz
              by flybuzz
               
              Started by spencerp92, 10-10-2023, 09:56 AM
              4 responses
              312 views
              0 likes
              Last Post flybuzz
              by flybuzz
               
              Working...
              X