Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Create a moving average from point A to point B

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

    Create a moving average from point A to point B

    Good afternoon!! Is it possible with NinjaScript to make a moving average start at point A and end at point B as indicated?
    Beforehand thank you very much!

    #2
    Hello BIOK.NT,

    It depends on what you mean. Is this an indicator or a custom method?

    You could supply a Series<double> object that only has values set on bars between a time range and then supply this as the input series to the SMA() indicator.

    Or you could make a custom method that loops through SMA() values between certain bars using the primary series.

    Or you could make a custom method that loops through specific bars and divides by the number of bars.
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Thanks a lot for your repy! In this case I need do as indicador but how I can supplu a Series<double> object that only has values set on bars between a time range?

      Comment


        #4
        Hello BIOK.NT,

        if (ToTime(Time[0]) >= 90000 && ToTime(Time[0]) < 100000) // if the bar time is equal to or greater than 9:00 am and is less than 10:00 am
        {
        MySeries[0] = 100; // a value is set to the series
        }
        Chelsea B.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Mindset, 04-21-2026, 06:46 AM
        0 responses
        93 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by M4ndoo, 04-20-2026, 05:21 PM
        0 responses
        138 views
        0 likes
        Last Post M4ndoo
        by M4ndoo
         
        Started by M4ndoo, 04-19-2026, 05:54 PM
        0 responses
        68 views
        0 likes
        Last Post M4ndoo
        by M4ndoo
         
        Started by cmoran13, 04-16-2026, 01:02 PM
        0 responses
        123 views
        0 likes
        Last Post cmoran13  
        Started by PaulMohn, 04-10-2026, 11:11 AM
        0 responses
        73 views
        0 likes
        Last Post PaulMohn  
        Working...
        X