Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Code equivalent?

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

    Code equivalent?

    Can anyone give me a hand with this bit of eS*gnal code, trying to port to NT. I need an equivalent of getValue but there is none of course.

    var Hi
    vHi = getValue("High", -nVariable2, -(variable3));

    Here is some help:

    getValue( barType [, nOffset] [, nNumBars] [,Symbol] )
    Returns a data series value or values RELATIVE to the bar currently being built.

    · barType: "Open", "High", "Low", "Close", "Time", "rawtime", "Volume", "oi", "year", "month", "day", "hour", "minute", "second"
    · nOffset: Offset from the "relative" bar. The relative bar is maintained by the formula engine. It is the index of the bar currently being computed.
    · nNumBars: Number of bars to return
    · Symbol: The symbol for which to return data. Symbol may have an Interval suffix (e.g., "IBM,5")

    #2
    Welcome to our forums here Buddy, please take a look at this reference sample, I believe our 'GetBar' would help you out - http://www.ninjatrader-support2.com/...ad.php?t=19176

    Comment


      #3
      Thanks but I don't think so. There is no time factor involved here. It looks like we are looking for the High from a bar, back so many bars? Anyone know how to interpret this?

      Comment


        #4
        You can also directly reference the High x bars ago with - High[barsAgo index]

        If you work with a MultiSeries context in a strategy please use Highs - http://www.ninjatrader-support.com/H...eV6/Highs.html

        Comment


          #5
          Thanks Bertrand but I think I need someone who understands what this code is doing in eSignal to help. High[x] is not going to do it here.

          Comment


            #6
            Buddy,

            Unfortunately we are not eSignal experts. If you can spell out the exact behavior in English terms then we could probably help. Otherwise hopefully a community member with eSignal experience can offer you some guidance. Good luck.
            Josh P.NinjaTrader Customer Service

            Comment


              #7
              Thanks Josh, that is exactly who I am asking.

              Comment


                #8
                Originally posted by Buddy View Post
                Can anyone give me a hand with this bit of eS*gnal code, trying to port to NT. I need an equivalent of getValue but there is none of course.

                var Hi
                vHi = getValue("High", -nVariable2, -(variable3));

                Here is some help:

                getValue( barType [, nOffset] [, nNumBars])
                Returns a data series value or values RELATIVE to the bar currently being built.

                · barType: "Open", "High", "Low", "Close", "Time", "rawtime", "Volume", "oi", "year", "month", "day", "hour", "minute", "second"
                · nOffset: Offset from the "relative" bar. The relative bar is maintained by the formula engine. It is the index of the bar currently being computed.
                · nNumBars: Number of bars to return
                Hi Buddy,

                Looks like this returns an array of High values...not just a single High value. The quantity of bars is determined by the "variable3" amount. Here's the situation:

                H7, H6, H5, H4, H3, H2, H1, H0 (current High)

                It appears, with the getValue method, you can retrieve all or some of these High values. If nOffset is -4,and nNumBars is +3, then you may be able to get the values H4, H3, H2, and have them placed into an array variable called vHi. Now, the odd thing is, what is the significance of the "-(variable3)"...I'm guessing here, but you may be able to reverse the order of the collection process...perhaps a negative value means you can gather the Highs that occurred prior to the nOffset bar? I don't know for sure. So, if nOffset is -4 and nNumBars is -3, then you may get H6, H5, H4.

                To implement this in NinjaScript, you'd have to do a simple for loop starting from the nOffset bar. You could write an equivalent method in Ninja to accomplish this, and return an array or List of Highs.

                Comment


                  #9
                  Thanks for the effort Ben. I can tell you that in eSignal the bar numbers for the CurrentBar are all negative numbers. In NT, Close[5] being the 5th bar previous to the current bar would be designated by a close(-5) in their code.

                  Comment


                    #10
                    Originally posted by Buddy View Post
                    Thanks for the effort Ben. I can tell you that in eSignal the bar numbers for the CurrentBar are all negative numbers. In NT, Close[5] being the 5th bar previous to the current bar would be designated by a close(-5) in their code.
                    That is how I understand it as well...so based on that, if the nNumBars is negative, I'd assume the sequence of Highs returned would be H6, H5 and H4.

                    The only way to determine if this is correct is to view the results of the code being run on an eSignal chart.

                    Comment

                    Latest Posts

                    Collapse

                    Topics Statistics Last Post
                    Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                    0 responses
                    593 views
                    0 likes
                    Last Post Geovanny Suaza  
                    Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                    0 responses
                    343 views
                    1 like
                    Last Post Geovanny Suaza  
                    Started by Mindset, 02-09-2026, 11:44 AM
                    0 responses
                    103 views
                    0 likes
                    Last Post Mindset
                    by Mindset
                     
                    Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                    0 responses
                    556 views
                    1 like
                    Last Post Geovanny Suaza  
                    Started by RFrosty, 01-28-2026, 06:49 PM
                    0 responses
                    554 views
                    1 like
                    Last Post RFrosty
                    by RFrosty
                     
                    Working...
                    X