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

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 Segwin, 05-07-2018, 02:15 PM
          14 responses
          1,788 views
          0 likes
          Last Post aligator  
          Started by Jimmyk, 01-26-2018, 05:19 AM
          6 responses
          837 views
          0 likes
          Last Post emuns
          by emuns
           
          Started by jxs_xrj, 01-12-2020, 09:49 AM
          6 responses
          3,291 views
          1 like
          Last Post jgualdronc  
          Started by Touch-Ups, Today, 10:36 AM
          0 responses
          11 views
          0 likes
          Last Post Touch-Ups  
          Started by geddyisodin, 04-25-2024, 05:20 AM
          11 responses
          62 views
          0 likes
          Last Post halgo_boulder  
          Working...
          X