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-Series Indicator Ploting problem

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

    Multi-Series Indicator Ploting problem

    Hi I am trying to develop a Multi-Series indicator to plot MAs from two diferent time frames but the high timeframe EMA does not plot a line, it has some gaps on it.

    I understand that I am using different time frames but is there anyway to plot a line without gaps?

    The timeframes I am using is range bars (8) and 30 mins.

    I know range bars make the X axis dinamic but I am wondering If I can have a continuos line for the 30 mins timeframe EMA plot.

    Thank you

    #2
    ivanov_c, welcome to our forums - could you please post a screenshot of the behavior you see?

    You likely would see a so called stepping effect for the higher timeframe MA value, as there's just an updated value each 30 min bar, this then visualized on a finer frame looks like a stairstep then...thanks.
    BertrandNinjaTrader Customer Service

    Comment


      #3
      Now that you ask me for a picture I just noticed that if I try to plot a line I miss a lot of data instead of having just some gaps, I am attaching 2 graphs, one using dots and the other one using a line.
      Attached Files

      Comment


        #4
        Hey ivanov,

        I suspect you are trying to plot while the wrong bar is in progress or using the wrong bars series.

        To get a feel for the order of the bars series do this:

        protected override void OnBarUpdate()
        {
        if (BarsInProgress == 0)
        {
        Print("0");
        }
        else if (BarsInProgress== 1)
        {
        Print("1");
        }
        else if(......etc....

        }

        And look at your output window (tools>output). I found the link below confusing and the method above easeir to wrap my head around:

        Comment


          #5
          Thank you for your reply mountainclimber but no, I do not think that is the problem.

          here is a piece of my code, I only have 2 time series, the second series is the one configured on 30 mins, the first one is the default for range 8.

          protected override void OnBarUpdate()
          {
          // Use this method for calculating your indicator values. Assign a value to each
          // plot below by replacing 'Close[0]' with your own formula.
          if (BarsInProgress == 1)
          {
          EMA20.Set(EMA(Close,
          20)[0]);
          }
          else
          {
          SlowHMA.Set(HMA(Close,slowMAPeriod)[
          0]);

          I was expecting a continuos line but the software does not even paint a line sometimes. I just want to know if that is the expected behavior in case I cannot connect the dots with I line when some bars are missing, because of the multiple time series or if it is a bug, or a workaround.

          Comment


            #6
            Can you include your Initialization() block as well? If so, I'll take a closer look at it.

            Comment


              #7
              Here it is:

              protected override void Initialize()
              {
              Add(
              new Plot(Color.FromKnownColor(KnownColor.Lime), PlotStyle.Line, "SlowHMA"));
              ...
              Add(new Plot(Color.FromKnownColor(KnownColor.Brown), PlotStyle.Line, "EMA20"));
              Add(PeriodType.Minute,
              30);
              ...
              }

              Comment


                #8
                Hello,

                So you are trying to plot the 30 min ema on a smaller timeframe? This worked on a 1 min. time frame, but didn't test it much and did it in 5 min's:
                if(BarsInProgress == 0)
                {
                SlowHMA.Set(HMA(Close,
                10)[0]);
                EMA20.Set(EMA20[
                1]);
                }
                elseif(BarsInProgress == 1)
                {
                EMA20.Set(EMA(Close,
                20)[0]);
                }

                In the screen shot you will see the orange lines are plotted on the chart via the chart UI for verification that the value I am plotting is accurate...and it seems to be.
                Attached Files

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by algospoke, Yesterday, 06:40 PM
                2 responses
                19 views
                0 likes
                Last Post algospoke  
                Started by ghoul, Today, 06:02 PM
                3 responses
                14 views
                0 likes
                Last Post NinjaTrader_Manfred  
                Started by jeronymite, 04-12-2024, 04:26 PM
                3 responses
                45 views
                0 likes
                Last Post jeronymite  
                Started by Barry Milan, Yesterday, 10:35 PM
                7 responses
                20 views
                0 likes
                Last Post NinjaTrader_Manfred  
                Started by AttiM, 02-14-2024, 05:20 PM
                10 responses
                180 views
                0 likes
                Last Post jeronymite  
                Working...
                X