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 syncronize chart with strategy

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

    Multi time frame syncronize chart with strategy

    Scenario:

    I have a strategy that uses multi time frames.
    For example it also reads: 1 minute and 3 minute

    The 1 minute is ok because all charts are always the same.
    However the 3 minute is not the same. The 3 minute can begin in any of 3 continuous minutes. Like a tick chart it can begin with any tick.

    Is there any way to synchronize a chart with a timeframe used in a strategy?

    What I am looking at on a chart is not the same as the strategy uses. I understand why but it drives me crazy when I look at my signals and try to figure out what happened. I look at one chart but the strategy uses a totally different chart in essence.

    I tried using the same days back on all timeframe charts but it didn't help.

    It would be nice if you could see an actual charts that are sync for a strategy.

    Regards

    Cliff

    #2
    Are you referring to how the bars are being built as outlined here? http://www.ninjatrader-support.com/H...struments.html

    You could try making the 3min bars your primary bars so you can see those for your signals?
    Josh P.NinjaTrader Customer Service

    Comment


      #3
      Josh

      I see you got the late shift again.

      Understood on the 3 minute primary but I also use a very small volume chart and it is the one that needs to be the primary so I am looking at the smallest chart I am getting signals from.

      So there is no way to sync a chart of an added timeframe to a strategy?

      I understand they all swing on a different clock I just didn't know if I can see what the strategy sees.

      Comment


        #4
        I forget how the exact behavior goes. Let me run some tests on my end and let you know.
        Josh P.NinjaTrader Customer Service

        Comment


          #5
          Hi ct,

          I believe things should be in sync for you as is. Please take a look at my attached test strategy. You will find the bar data is printed accurately and in sync with the multiple time frames.

          I suspect if you are using a custom indicator you may need to use Update() to keep the values in sync. http://www.ninjatrader-support.com/H...V6/Update.html
          Attached Files
          Josh P.NinjaTrader Customer Service

          Comment


            #6
            Josh


            No custom indicators used.

            That may be some of the issue. I had a signal where the strategy said the macd on the 5 minute timeframe was up. I went 5 bars+ either side of the signal time and it was always down but I still got an up signal. Below is the code that is checked.

            I know I can use rising or falling but it doesn't work well for multi time frames so I never use it. Been burned bad. Wounds are healed but left bad scars.

            _required.Add(delegate()
            {
            return (s.MACD(19,38,9)[0] > s.MACD(19,38,9)[1]
            && s.MACD(s.BarsArray[s.InstrumentPosition["1-Minute"]],19,38,9)[0] > s.MACD(s.BarsArray[s.InstrumentPosition["1-Minute"]],19,38,9)[1]
            && s.MACD(s.BarsArray[s.InstrumentPosition["5-Minute"]],19,38,9)[0] > s.MACD(s.BarsArray[s.InstrumentPosition["5-Minute"]],19,38,9)[1]
            )

            ;
            });

            Will see if your mod helps....

            Comment


              #7
              Josh

              I sent you some screen shots via support ticket system.Ticket number is 56159.

              If I am not using a custom indicator can I still have multi timeframe data issues?

              Comment


                #8
                Hi ct,

                I currently do not have direct access to the ticket system. If you don't mind could you send me the screenshots directly? josh [at] ninjatrader [dot] com. Thanks.

                I believe the issue is not data per se. It is just that under certain situations a custom indicator may not be kept up to date with the current bar being processed.
                Josh P.NinjaTrader Customer Service

                Comment


                  #9
                  Josh

                  Ticket email forwarded.

                  If I have 3 timeframes all using the same instrument and I am using CalculateOnBarClose = false; should I only perform my calcs on BarsInProgress == 3? Since it is 3rd will it always be called last (after 1 and 2 are updated) if using the same instrument?

                  Could be part of my problem but not all of it.

                  Comment


                    #10
                    Ninja Release

                    Josh

                    Forgot to mention I am on 6.5.0.4.

                    Cliff

                    Comment


                      #11
                      It would be easier on your coding to run your calculations on only the last bar series, but you do not need to necessarily restrict yourself in that manner. If you have a need to run calculations in other bars you can.

                      I'm reviewing your screenshots right now along with the code snippet you provided. The only thing I can think of is for you to check if s.InstrumentPosition["5-Minute"] is actually giving you the correct bar object.
                      Josh P.NinjaTrader Customer Service

                      Comment


                        #12
                        Is should be the correct bar object:


                        Add(PeriodType.Minute, 1);
                        InstrumentPosition.Add("1-Minute", 1);
                        Add(PeriodType.Minute, 1);
                        InstrumentPosition.Add("5-Minute", 2);
                        Add(PeriodType.Volume, 500);
                        InstrumentPosition.Add("500-Volume", 3);

                        Comment


                          #13
                          Give me a moment. I accidentally destroyed my NT6.5 environment and need to rebuild it before I can test some stuff for you.
                          Josh P.NinjaTrader Customer Service

                          Comment


                            #14
                            When I reference another timeframe I always do it explicitly and specify the bars array. It makes it easier for me to keep track of. Otherwise you are saving values from each onbarupdate to compare once you have them all collected.

                            Comment


                              #15
                              Originally posted by Josh View Post
                              Give me a moment. I accidentally destroyed my NT6.5 environment and need to rebuild it before I can test some stuff for you.

                              ok, I am going to get a few hours sleep. I have been trying to resolve this issue for a while. I am beat.

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by DJ888, 04-16-2024, 06:09 PM
                              4 responses
                              12 views
                              0 likes
                              Last Post DJ888
                              by DJ888
                               
                              Started by terofs, Today, 04:18 PM
                              0 responses
                              7 views
                              0 likes
                              Last Post terofs
                              by terofs
                               
                              Started by nandhumca, Today, 03:41 PM
                              0 responses
                              6 views
                              0 likes
                              Last Post nandhumca  
                              Started by The_Sec, Today, 03:37 PM
                              0 responses
                              3 views
                              0 likes
                              Last Post The_Sec
                              by The_Sec
                               
                              Started by GwFutures1988, Today, 02:48 PM
                              1 response
                              9 views
                              0 likes
                              Last Post NinjaTrader_Clayton  
                              Working...
                              X