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 Hwop38, 05-04-2026, 07:02 PM
            0 responses
            161 views
            0 likes
            Last Post Hwop38
            by Hwop38
             
            Started by CaptainJack, 04-24-2026, 11:07 PM
            0 responses
            309 views
            0 likes
            Last Post CaptainJack  
            Started by Mindset, 04-21-2026, 06:46 AM
            0 responses
            245 views
            0 likes
            Last Post Mindset
            by Mindset
             
            Started by M4ndoo, 04-20-2026, 05:21 PM
            0 responses
            349 views
            0 likes
            Last Post M4ndoo
            by M4ndoo
             
            Started by M4ndoo, 04-19-2026, 05:54 PM
            0 responses
            179 views
            0 likes
            Last Post M4ndoo
            by M4ndoo
             
            Working...
            X