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 strategy with periods of different size

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

    Multi-time frame strategy with periods of different size

    Hi,

    I appreciate any help and I'll try to explain in English:

    I'm programming a multi-time frame strategy, in 15min bars, for the ES instrument in RTH. I apply a filter in 3min bars, to specify the entries, but I need to take several bars outside RTH. I can not change session begins and session ends in the main chart without modify the parameters of the indicators used and discredit the system. How can I incorporate these bars outside RTH in my strategy?

    Best regards.

    #2
    Hi there, unfortunately this isn't possible with NinjaTrader 6.5 unless you create some sort of time filter that only lets your strategy trade during certain time periods.
    AustinNinjaTrader Customer Service

    Comment


      #3
      Thanks for your reply.

      A time filter is not the solution because the problem is not to establish a time period for the trades, is to establish a time period for the indicators.

      Is it possible in NinjaTrader7?

      If this is possible please indicate the detailed logic.

      Best regards.

      Comment


        #4
        pequemec,

        Indicators always run on the full information displayed on the chart. If you only want it to use a subset you need to program a time filter into the indicator itself (not the strategy) to be able to allow the strategy to trade on the full hours. It may require more adjusting of indicator logic to accommodate not setting certain bars.
        Josh P.NinjaTrader Customer Service

        Comment


          #5
          Josh,

          What type of filter would be? The filter of the type:

          if (ToTime (Time [0]) <= 153000) return;

          remove plot lines but do not alter the value of the indicator.

          Comment


            #6
            pequemec, what you seek will require you to code the entire indicator into your strategy and then wrap the time filters around it. This will most likely not be an easy task. You can use the ToTime() function to quickly verify if the time is during some period like this:
            Code:
            if (ToTime(Time[0]) >= 93000 && ToTime(Time[0]) <= 160000)
            {
                // the time is between 9:30am and 4pm
                // you can set your indicator logic to only run during this time period
            }
            AustinNinjaTrader Customer Service

            Comment


              #7
              Sorry, but for me this is not a good solution. Could you tell me as they have solved this in version7?. It's as simple as documenting the logic that I use to create a strategy multitimeframe with different sessions for each BarsInProgress.

              Comment


                #8
                pequemec,

                How we have been outlining is how it works. It will work for what you have outlined. You need to use time filters. You can either get the indicator logic into the strategy directly like Austin mentioned or you can program the time filter into the indicator directly. Unfortunately there is no way around this. 7 works exactly the same way.
                Josh P.NinjaTrader Customer Service

                Comment


                  #9
                  Suppose we apply that logic in the indicator Bollinger. Syntax:

                  protected override void OnBarUpdate()
                  {
                  //Filtro temporal
                  if (ToTime(Time[0]) > 153000 && ToTime(Time[0]) <= 221500)
                  miscierres.Set(Close[0]);
                  else
                  return;

                  BandaSuperior.Set(SMA(miscierres, periodo)[0] + desvest * StdDev(miscierres, periodo)[0]);
                  BandaMedia.Set(SMA(miscierres,periodo)[0]);
                  BandaInferior.Set(SMA(miscierres, periodo)[0] - desvest * StdDev(miscierres, periodo)[0]);

                  }


                  What happens is that you fill the "gaps" of zeros. How do I fix?
                  Attached Files

                  Comment


                    #10
                    I'm not sure I follow what you mean 'with gaps of 0's', but for sure it will disrupt indicator continuity the way you programmed it as it does not have enough data to initialize calcs properly at time filter start.
                    BertrandNinjaTrader Customer Service

                    Comment


                      #11
                      Ok, How do I maintain the continuity of the indicator?
                      Sorry but I'm not a programmer

                      Comment


                        #12
                        pequemec,

                        You can't use [0] the way it works out of the box because you are skipping bars with your time filter. You need to program logic that uses only the series at points you want for your calculations. Unfortunately this would require some more extensive programming to achieve. You may want to consider one of these 3rd party NinjaScript Consultants here: http://www.ninjatrader.com/webnew/pa...injaScript.htm
                        Josh P.NinjaTrader Customer Service

                        Comment

                        Latest Posts

                        Collapse

                        Topics Statistics Last Post
                        Started by alifarahani, 04-19-2024, 09:40 AM
                        8 responses
                        53 views
                        0 likes
                        Last Post alifarahani  
                        Started by mmckinnm, Today, 01:34 PM
                        2 responses
                        5 views
                        0 likes
                        Last Post mmckinnm  
                        Started by Conceptzx, 10-11-2022, 06:38 AM
                        3 responses
                        60 views
                        0 likes
                        Last Post NinjaTrader_SeanH  
                        Started by f.saeidi, Today, 01:32 PM
                        1 response
                        2 views
                        0 likes
                        Last Post NinjaTrader_Erick  
                        Started by traderqz, Today, 12:06 AM
                        9 responses
                        16 views
                        0 likes
                        Last Post NinjaTrader_Gaby  
                        Working...
                        X