Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

EMA on Open Price of Bar?

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

    EMA on Open Price of Bar?

    Hi, How does one in Ninja Script declare that you would like to calculate the EMA on the Opening Price of the bar and not the close?

    For example, the line below will calculate for the Close of the Bar right?

    Add(EMA(5));

    What about if I wanted to use the Open Price of the Bar or H - L /2 ???

    Thanks

    David

    #2
    Hello,

    To calculate from the Open rather than the close, you would use Add(EMA(Open, 5));

    You could also use, High, Low, Median, Typical, etc.
    MatthewNinjaTrader Product Management

    Comment


      #3
      Thank you for the response.

      I am using Multi-TimeFrame and Instruments.

      Consider,

      Add(EMA(Open, 20));

      But I would like to use the EMA20 Open in a condition statement from my BarArrays[1] ??

      Consider the below condition statement using the EMA Close 20

      if (Closes[1][0] > EMA(BarsArrays[1], 20)[0])
      {
      //do something
      }

      How would I do the same above however with the EMA Open 20?

      Thanks again

      David

      Comment


        #4
        Hello David,

        In that case, you would use Opens:



        if (Closes[1][0] > EMA(Opens[1], 20)[0])
        MatthewNinjaTrader Product Management

        Comment


          #5
          Thank you Matthew, that makes absolute sense, don't know why I didn't see that!

          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