Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Know the SMA value of a new time

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

    Know the SMA value of a new time

    Hello friends.

    In a 5 minute chart....


    I declare the new time in Initialize() method as it:

    protected override void Initialize(){
    Add(PeriodType.Minute, 10);
    }


    Now i want to now the SMA(14) value. In normal way i get as it:

    double myValue= SMA(14);


    I want to know the value of SMA(14) in 10 minutes time, How can i get?

    Thank you

    #2
    Hello marynja,

    You would want to use the BarsArray to be able to tell the SMA which Data Series you would like to get the value of the SMA. For example:

    Code:
    Print("SMA of 5 Min = "+SMA(BarsArray[0], 14)[0]);
    Print("SMA of 10 Min = "+SMA(BarsArray[1], 14)[0]);
    You may also read more about this at the following link to our Help Guide.
    JCNinjaTrader Customer Service

    Comment


      #3
      Thank you so much.

      And, its possible to draw a indicator value in original chart time?

      I draw the SMA of 5 minute as it:

      Add(SMA(100));

      How could i draw the SMA for 10 minutes?

      I tried this, but dont work:

      protected override void Initialize(){
      Add(PeriodType.Minute, 10);
      Add(SMA(100));
      Add(SMA(BarsArray[1], 100));
      }

      Comment


        #4
        Hello marynja,

        You would only be able to do that if you are working with a Strategy. Inside of another Indicator, you would have to set the value of a plot to the Indicators values manually.
        Example:
        Code:
        Plot2.Set(SMA(BarsArray[1], 14)[0]);
        JCNinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Geovanny Suaza, 02-11-2026, 06:32 PM
        0 responses
        576 views
        0 likes
        Last Post Geovanny Suaza  
        Started by Geovanny Suaza, 02-11-2026, 05:51 PM
        0 responses
        334 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
        553 views
        1 like
        Last Post Geovanny Suaza  
        Started by RFrosty, 01-28-2026, 06:49 PM
        0 responses
        551 views
        1 like
        Last Post RFrosty
        by RFrosty
         
        Working...
        X