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

Want Multi-Timeframe (3 TF's) Indicator on a chart based on the middle timeframe

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

    Want Multi-Timeframe (3 TF's) Indicator on a chart based on the middle timeframe

    I want an indicator that uses multiple timeframes for calculations. For example, I want 240 min, 15 min, and 1 minute data to be used on a 15 minute chart. So the key is that the chart is based on the middle timeframe (15 min).

    So for a 15 minute chart (one symbol), I call this in Initialize():

    Add(PeriodType.Minute, 240);
    Add(PeriodType.Minute, 1);

    When I add this indicator to the 15 minute chart, it clears the chart, and hangs forever. I have to close the chart to get control back. Nothing is displayed on the output window.

    If I use a 1 Minute chart, and add the 240 and 15 minute series, everything works. But this will not meet my needs for visualization reasons - I cant display the indicator on the 1 minute chart.

    I have not seen any exclusions in the doc, or any other examples that use a low timeframe for the added series than the chart, so Im sorry if its a RTFM they query.

    Is this a defect or not allowed? Any other approach I can use to achieve the same thing?

    Thanks,

    -Steve
    Attached Files

    #2
    Originally posted by stevefym View Post
    I want an indicator that uses multiple timeframes for calculations. For example, I want 240 min, 15 min, and 1 minute data to be used on a 15 minute chart. So the key is that the chart is based on the middle timeframe (15 min).

    So for a 15 minute chart (one symbol), I call this in Initialize():

    Add(PeriodType.Minute, 240);
    Add(PeriodType.Minute, 1);

    When I add this indicator to the 15 minute chart, it clears the chart, and hangs forever. I have to close the chart to get control back. Nothing is displayed on the output window.

    If I use a 1 Minute chart, and add the 240 and 15 minute series, everything works. But this will not meet my needs for visualization reasons - I cant display the indicator on the 1 minute chart.

    I have not seen any exclusions in the doc, or any other examples that use a low timeframe for the added series than the chart, so Im sorry if its a RTFM they query.

    Is this a defect or not allowed? Any other approach I can use to achieve the same thing?

    Thanks,

    -Steve
    Where is your CurrentBar check?



    Nevermind, where is your BarsInProgress check? Each Bar in progress (0 15min,1 240min ,2 1min) calls OnBarUpdate... Do you have data for 240 minutes?


    I might setup market replay on my desktop for tomorrow to test this out...

    Is this on a future or stock?

    Comment


      #3
      Using IQFeed - lots of data - different source timeframes - same result.

      Also tried with IB data.

      Have been testing with Forex (EUR/USD), but it fails with stocks as well.

      Since it works on a 1 minute chart (adding 240 min, and 15 min in init), it does not seem like its a data issue.

      Thanks very much for the help!

      Comment


        #4
        Steve, would you see the same issue on your end with the GetTradeState and GetSl properties commented out?
        BertrandNinjaTrader Customer Service

        Comment


          #5
          Bertrand,

          Yes - that is the issue. When I removed those methods, it works.

          Is it the Update() method that is causing the problem? Do they need to be filtered somehow? I still would like to feed the output of this indicator into a Strategy - is there another way?

          Worst case would be to have two versions of the indicator, one for graphing visually, the other a 1 minute chart that does the calculation and shares the data. Not too efficient and difficult to maintain, but It unblocks me.

          Thanks so much for the help,

          -S

          Comment


            #6
            Steve, looked further into and this attached version would not show any issues for me. Made the internal variables private and ensured the public getters are not browsable and xml ignored.
            Attached Files
            BertrandNinjaTrader Customer Service

            Comment


              #7
              Bertrand,

              That nailed it. Works perfectly. Thanks so much for the quick turnaround.

              -S

              Comment


                #8
                Glad to hear that, continued success with those custom works.
                BertrandNinjaTrader Customer Service

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by chbruno, Today, 04:10 PM
                0 responses
                3 views
                0 likes
                Last Post chbruno
                by chbruno
                 
                Started by josh18955, 03-25-2023, 11:16 AM
                6 responses
                436 views
                0 likes
                Last Post Delerium  
                Started by FAQtrader, Today, 03:35 PM
                0 responses
                6 views
                0 likes
                Last Post FAQtrader  
                Started by rocketman7, Today, 09:41 AM
                5 responses
                19 views
                0 likes
                Last Post NinjaTrader_Jesse  
                Started by frslvr, 04-11-2024, 07:26 AM
                9 responses
                127 views
                1 like
                Last Post caryc123  
                Working...
                X