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

Optimizing time series for multi-timeframe

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

    Optimizing time series for multi-timeframe

    Hello,

    Is it possible to optimize value of time of secondary timeframes (added data serie) ?


    Example: Strategy based on CCI entry , Profit target exit.

    Timeframe 1: 15 minutes (CCI 15 minutes, value below -100 to enter an order)
    I know I can optimize this one, using "optimize data series"

    Timeframe 2: 60 minutes (CCI 60 minutes, value below -100 to enter an order)
    Is it possible to optimize this one ?

    #2
    Hello markkm,

    Thanks for your post.

    It is not supported to use User Defined Inputs to define a secondary data series, so it would not be supported to to optimize the secondary data series in that fashion.

    This note and other notes can be seen in the AddDataSeries() page of the help guide.

    AddDataSeries() - https://ninjatrader.com/support/help...dataseries.htm

    An alternative approach would be to add each data series you would like to optimize against, and then to create a User Defined Input to modify the strategy's logic so it uses the BarsInProgress index for the data series you want to optimize. For example, if you add a parameter for DataSeriesToOptimize, this parameter could be used in a condition like if (BarsInProgress == DataSeriesToOptimize) to control the strategy logic.

    Multi Time Frame NinjaScript reference can be found here - https://ninjatrader.com/support/help...nstruments.htm

    We are tracking interest to be able to dynamically add data series (based on user defined inputs) via NinjaScript with the feature request ticket ID SFT-882. This would make it possible to easily optimize a secondary data series. I've added a vote on your behalf.

    Feature request interest is aggregated before it is determined if the feature should be implemented, so we can't offer an ETA. Upon implementation the ticket ID can be found publicly on the Release Notes page of the help guide.

    Release Notes: https://ninjatrader.com/support/help...ease_notes.htm

    Please let us know if we can be of further help.
    JimNinjaTrader Customer Service

    Comment


      #3
      Thanks,
      I am trying with the alternative approach and it works when (BarsInProgress == CONSTANT) and not an user defined input.

      This works fine.

      protected override void OnBarUpdate()
      {
      if (BarsInProgress == 2)
      return;

      if (CurrentBars[0] < 1
      || CurrentBars[1] < 1
      || CurrentBars[2] < 1
      || CurrentBars[3] < 1)
      return;

      // Set 1
      if ((CrossBelow(DoubleStochastics1, 20, 1))
      && (Position.Quantity == 0))
      {
      EnterLong(2, Convert.ToInt32(DefaultQuantity), "");



      but not this (my user defined input is called TimeValue1)

      protected override void OnBarUpdate()
      {
      if (BarsInProgress == TimeValue1)
      return;

      if (CurrentBars[0] < 1
      || CurrentBars[1] < 1
      || CurrentBars[2] < 1
      || CurrentBars[3] < 1)
      return;

      // Set 1
      if ((CrossBelow(DoubleStochastics1, 20, 1))
      && (Position.Quantity == 0))
      {
      EnterLong(TimeValue1 ,Convert.ToInt32(DefaultQuantity), "");

      Comment


        #4
        Hello markkm,

        You are skipping all strategy operations when BarsInProgress == TimeValue1

        if (BarsInProgress == TimeValue1)
        return;


        Please see the demonstration below for a working example.

        Demo - https://i.imgur.com/fOUQMoo.gif

        Please let us know if you have any questions.
        Last edited by NinjaTrader_Jim; 08-03-2018, 08:57 AM.
        JimNinjaTrader Customer Service

        Comment


          #5
          Thanks,
          This works for instrument optimization and no timeframe, so in your example, you're optimizing 0,1,2, which is ether GC,CL,ES.
          Now the question I have: How do you optimize timeframe, for example ES(input1 for tick value), ES(input2 for tick value, ES(input3 for tick value)?

          Comment


            #6
            Hello markkm,

            This would have to be done by adding a data series for each time frame, and then taking the same approach to process the strategy logic for the BarsInProgress index of the data series you are optimizing.
            JimNinjaTrader Customer Service

            Comment


              #7
              If I understand you well, I have to add 1x timeframe for each time I want to optimize? And then optimize which timeframe added in added data series is performing well?

              If this is the case, I don't think It's efficient as the built in feature for the primary instrument where increments could be used for optimization e.g. (100 tick to 10000 tick increment 100) VS creating 100 added data series to see which one performs best.

              Comment


                #8
                Correct, this is a workaround that can get cumbersome as you scale up. It works fine for small comparisons, but I would not recommend doing this for large optimizations.
                JimNinjaTrader Customer Service

                Comment


                  #9
                  Ok, thanks a lot

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by Christopher Leggit, 02-15-2024, 09:00 AM
                  3 responses
                  45 views
                  0 likes
                  Last Post rdtdale
                  by rdtdale
                   
                  Started by DavidHP, Today, 07:56 AM
                  0 responses
                  2 views
                  0 likes
                  Last Post DavidHP
                  by DavidHP
                   
                  Started by Aviram Y, 08-09-2023, 09:04 AM
                  10 responses
                  298 views
                  0 likes
                  Last Post MrHump
                  by MrHump
                   
                  Started by jpapa, Today, 07:22 AM
                  1 response
                  5 views
                  0 likes
                  Last Post NinjaTrader_Gaby  
                  Started by kevinenergy, 02-17-2023, 12:42 PM
                  116 responses
                  2,758 views
                  1 like
                  Last Post kevinenergy  
                  Working...
                  X