Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Indicator to plot on last 10 bars of chart

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

    Indicator to plot on last 10 bars of chart

    I am developing an indicator which needs to plot SMA 34 for the last 10 bars of chart and before 10 bars it should plot SMA 21.

    Tried various methods but still not able to get any working version.

    For SMA 21, I can use Plot21.Set(10,SMA(21)[0]); but for the SMA 34 cannot figure out the exact conditions. I have used ((Count-1) - CurrentBar == 10) but it does not dynamically moves the plot as the chart progresses.

    I will greatly appreciate any help in this regards.

    Thank you

    #2
    Originally posted by sherazwaqar View Post
    I am developing an indicator which needs to plot SMA 34 for the last 10 bars of chart and before 10 bars it should plot SMA 21.

    Tried various methods but still not able to get any working version.

    For SMA 21, I can use Plot21.Set(10,SMA(21)[0]); but for the SMA 34 cannot figure out the exact conditions. I have used ((Count-1) - CurrentBar == 10) but it does not dynamically moves the plot as the chart progresses.

    I will greatly appreciate any help in this regards.

    Thank you
    I think that your method may be going about it in a convoluted way that may not even work.

    Better would be to simply set the Plot to SMA(34), then reset the Plot 10 bars back to SMA(21). As this would be editing a historical data stream, you would automatically have a running update. You need only one Plot: just reset it as necessary.
    Last edited by koganam; 07-17-2013, 12:00 PM. Reason: Corrected spelling.

    Comment


      #3
      Hi Sherazwaqar,

      Thank you for your post.

      I can see you are using one of the overload methods from the Plot.Set(); which contains
      Code:
      Plot.Set(Int barsAgo, double Value);
      Can you share a sample of the code? If you feel more comfortable you can send me an email with the strategy attached to Suppor[at]Ninjatrader[dot]com
      Put: ATTN Cal in the subject line and reference this post.

      Thank you for your patience.
      Cal H.NinjaTrader Customer Service

      Comment


        #4
        Originally posted by koganam View Post
        I think that your method may be going about it in a convoluted way that may not even work.

        Better would be to simply set the Plot to SMA(34), then reset the Plot 10 bars back to SMA(21). As this would be editing a historical data stream, you would automatically have a running update. You need only one PLot: just reset it as necessary.
        Thank you for your quick response. My brain is numb on this. Can you please share a code example. What is the condition to reset the plot.

        For example

        Plot34.Set(SMA(34)[0]);

        if(Condition) // Please provide some help on the condition
        {
        Plot34.Set(10,SMA(21)[0]);
        }

        Comment


          #5
          Originally posted by sherazwaqar View Post
          Thank you for your quick response. My brain is numb on this. Can you please share a code example. What is the condition to reset the plot.

          For example

          Plot34.Set(SMA(34)[0]);

          if(Condition) // Please provide some help on the condition
          {
          Plot34.Set(10,SMA(21)[0]);
          }
          From the description that you gave, no condition is necessary! It will be an unconditional reset.
          Code:
          Plot34.Set(SMA(34)[0]);
          Plot34.Set(10,SMA(21)[10]);
          Last edited by koganam; 07-17-2013, 10:34 PM.

          Comment


            #6
            Thank you koganam for your help

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by Geovanny Suaza, 02-11-2026, 06:32 PM
            0 responses
            566 views
            0 likes
            Last Post Geovanny Suaza  
            Started by Geovanny Suaza, 02-11-2026, 05:51 PM
            0 responses
            330 views
            1 like
            Last Post Geovanny Suaza  
            Started by Mindset, 02-09-2026, 11:44 AM
            0 responses
            101 views
            0 likes
            Last Post Mindset
            by Mindset
             
            Started by Geovanny Suaza, 02-02-2026, 12:30 PM
            0 responses
            547 views
            1 like
            Last Post Geovanny Suaza  
            Started by RFrosty, 01-28-2026, 06:49 PM
            0 responses
            548 views
            1 like
            Last Post RFrosty
            by RFrosty
             
            Working...
            X