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 DannyP96, 05-18-2026, 02:38 PM
        1 response
        85 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Started by CarlTrading, 05-11-2026, 05:56 AM
        0 responses
        143 views
        0 likes
        Last Post CarlTrading  
        Started by CarlTrading, 05-10-2026, 08:12 PM
        0 responses
        83 views
        0 likes
        Last Post CarlTrading  
        Started by Hwop38, 05-04-2026, 07:02 PM
        0 responses
        256 views
        0 likes
        Last Post Hwop38
        by Hwop38
         
        Started by Mindset, 04-21-2026, 06:46 AM
        0 responses
        334 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Working...
        X