Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Multi timeframe indicator

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

    Multi timeframe indicator

    Hi,

    On a daily chart, i'm trying to plot daily high &weekly high. for weekly high, i have added Add(PeriodType.Week, 1) and plotting Highs[1][0].

    But the plot doesnt not seem to be a weekly plot. Looks like the weekly plot is delayed. Am i missing something.

    Regards,
    Selvan

    #2
    Hello,

    Thank you for the question.

    Can you please provide more detail or an image of what you are referring to as delayed?

    If you are doing something similar to the following you should see a plot that stays at the same value between weeks like the attached image. The indicator is just overlaid on weekly bars.

    Code:
    protected override void Initialize()
    {
    	Add(new Plot(Color.Red, "plot"));
    	Add(PeriodType.Week, 1);
    }
    
    protected override void OnBarUpdate()
    {
    	if (CurrentBars[1] < 1) return;
    	Value.Set(Highs[1][0]);
    }
    Attached Files

    Comment


      #3
      Thanks for your reply.

      I have used a very similar code, but i want to display both the daily and weekly plot on the daily chart. Please find the screenshot attached.

      Red line is the weekly plot.

      Regards,
      Selvan
      Attached Files

      Comment


        #4
        Hello mmuthamilselvan,

        Thank you for your response and welcome to the NinjaTrader Support Forum!

        Please try setting the indicator to CalculateOnBareClose = False and advise if the plot is still delayed.

        Comment


          #5
          Looks better now. thanks

          Comment


            #6
            one more question.. i have set parameter for enabling the multiframe indicators like Daily,Weekly,Monthly,Quarterly etc.. when i enabled each one of them, each of the plot comes up correctly. So if i enabled Daily and weekly, i can see daily high and weekly highs plotted on the daily chart.

            Now when i disable one of them(for ex: Weekly), i expect the daily high to be plotted,but the entire chart goes blank and i cannot see anything,none of the buttons on the top panel works.

            am i doing something wrong here ?

            Comment


              #7
              Hello,

              This could be caused if the indicator has an error that it can not recover from or can not continue plotting possibly.

              Can you try the action you described with the Output Window open to see if any errors are generated?

              You can open the output from Tools -> Output Window.

              After doing this if you receive output please let me see the errors otherwise if nothing is printed please let me know and we can determine what is causing that.

              I look forward to being of further assistance,

              Comment


                #8
                There is nothing on the output window. I noticed one thing, there is no error when I load both the additional data series(weekly, monthly) and then when I enable/disable their plots.

                But when I make the add dataseries itself condition, screen goes blank when I enable and disable them.

                Comment


                  #9
                  Hello,
                  Thank you for the additional details.

                  Can you please clarify what you mean:
                  But when I make the add dataseries itself condition, screen goes blank when I enable and disable them.
                  If you have the Add() statement in Initialize in a condition this would more than likely be the cause.

                  Please let me know if this is the case and I can detail what the issue is, otherwise please provide more detail on what you are doing with the Add dataseries here.

                  I look forward to being of further assistance.

                  Comment


                    #10
                    Hello,

                    You are right. I have the add()statement in initialize inside a condition.

                    Thanks,
                    Selvan

                    Comment


                      #11
                      Hello,

                      Thank you for clearing that up.

                      The Initialize section in general should not have user changeable conditions in it because Initialize is what is set in the start of the indicator when it is first applied.

                      The Add statement specifically, if in a condition where it is on or off depending on user setting will cause the chart to stop working correctly if you add a series and then do not add the series when changing the settings.

                      The only way it would work would be to set the setting and then apply the indicator, to change the setting you would need to completely remove the indicator and the initially set the setting again to what you want and apply the indicator. This is not the correct process.

                      Instead you will want to just add the series always and then toggle later in the script if that series is used in your logic.

                      If you are unsure how to do this please post the section of the code where you use the series and I will see if I can assist with that.

                      I look forward to being of further assistance.

                      Comment


                        #12
                        Hello,

                        Thanks for your reply.

                        I am planning to have plots of 9-10 data series in a indicator., plots are conditinal based on user settings. If I load them all in initialize, it takes a while to load, so I thought to make the data series also conditional.

                        But as per your reply, there is no good way to achieve that.

                        Regards,
                        Selvan

                        Comment

                        Latest Posts

                        Collapse

                        Topics Statistics Last Post
                        Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                        0 responses
                        633 views
                        0 likes
                        Last Post Geovanny Suaza  
                        Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                        0 responses
                        364 views
                        1 like
                        Last Post Geovanny Suaza  
                        Started by Mindset, 02-09-2026, 11:44 AM
                        0 responses
                        105 views
                        0 likes
                        Last Post Mindset
                        by Mindset
                         
                        Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                        0 responses
                        567 views
                        1 like
                        Last Post Geovanny Suaza  
                        Started by RFrosty, 01-28-2026, 06:49 PM
                        0 responses
                        568 views
                        1 like
                        Last Post RFrosty
                        by RFrosty
                         
                        Working...
                        X