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

BarsArray[] Usage Question

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

    BarsArray[] Usage Question

    Normally, a simple moving average based on closing price, however if wanting it based on High from a BarsArray[], which of these is correct....

    SMA(BarsArray[1].High, 20)[0]

    SMA(BarsArray[1], 20).High[0]

    SMA(BarsArray[1],20)[0].High

    Couldn't find any examples. Thanks

    #2
    borland, you could start working with Highs[barsArrayIndex][barsAgo], which is a multi-dimensional array of all bars' highs. There is an equivalent array for all of the following: Opens, Lows, Closes, Volumes, and Times.
    AustinNinjaTrader Customer Service

    Comment


      #3
      Thanks Austin,

      Then it must be this ...

      SMA(Highs[1],20)[0]

      for SMA based on intrabar high, and these

      SMA(BarsArray[1],20)[0]
      SMA(Closes[1],20)[0]

      for SMA based on closing bar price.

      I now see we have Highs[], Lows[], Closes[], Opens[].

      So, since Closes[] is identical to BarsArray[] when used with SMA. Why is there a BarsArray[] method?

      Comment


        #4
        Correct, BarsArray[0] would for example equal Close[0] - it returns just the dataseries for the specifc bars object pointed to, while for example Closes etc would also offer a second parameter for referencing past index values of the bars object.
        BertrandNinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by mattbsea, Today, 05:44 PM
        0 responses
        3 views
        0 likes
        Last Post mattbsea  
        Started by RideMe, 04-07-2024, 04:54 PM
        6 responses
        31 views
        0 likes
        Last Post RideMe
        by RideMe
         
        Started by tkaboris, Today, 05:13 PM
        0 responses
        2 views
        0 likes
        Last Post tkaboris  
        Started by GussJ, 03-04-2020, 03:11 PM
        16 responses
        3,282 views
        0 likes
        Last Post Leafcutter  
        Started by WHICKED, Today, 12:45 PM
        2 responses
        20 views
        0 likes
        Last Post WHICKED
        by WHICKED
         
        Working...
        X