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

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 PaulMohn, Today, 05:00 AM
            0 responses
            8 views
            0 likes
            Last Post PaulMohn  
            Started by ZenCortexAuCost, Today, 04:24 AM
            0 responses
            6 views
            0 likes
            Last Post ZenCortexAuCost  
            Started by ZenCortexAuCost, Today, 04:22 AM
            0 responses
            3 views
            0 likes
            Last Post ZenCortexAuCost  
            Started by SantoshXX, Today, 03:09 AM
            0 responses
            16 views
            0 likes
            Last Post SantoshXX  
            Started by DanielTynera, Today, 01:14 AM
            0 responses
            5 views
            0 likes
            Last Post DanielTynera  
            Working...
            X