Announcement

Collapse
No announcement yet.

In your Pivot Scripts - What is returned by high(inv("D")) ?

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

  • In your Pivot Scripts - What is returned by high(inv("D")) ?

    Hi, In trying to understand what a series object is, I've run across a line of code in one of your provided formula scripts (PivotPointAll.efs) that I need clarification on. The line "xHigh = high(inv("D"));" produces a value when I try to print it with debugPrintln(...) that doesn't make any sense to me. I use the debugPrint and debugPrintln functions a lot to help me understand your scripting code but in this case I think I'm just having trouble grapling with the concept of what a series function is since the return value I get makes no sense. Could you explain what this line of code should return with only the "inv("D")" argument provided to the high(...) call? [BTW - I've looked in your knowledgebase extensively and have not found the answer to this question (or even what exactly a series object is there either - I thought I had it figured out but the answer I think I should get does not match what I get for the above, so it looks like I don't, in fact, know]

    As a Bonus Question: The objective I was trying to reach was to be able change this file so that it calculated pivots at 9:00pm western to align with 12:00am eastern. Is this possible?

    Thanks! - tw

  • #2
    tw
    A Series Object is a special type of internal data structure used by the EFS2 engine. It is essentially an enhanced array that contains a value for each bar in the chart. If you tried to send the Series Object to the debugPrintln() function the EFS engine would normally attempt to print all the values in the series to the output window. As this could potentially be a very large amount of data to print the EFS2 engine prevents this action and simply prints [object series].
    If you just want to look at a specific value of the series you need to use the .getValue() method
    Using your code example if you wanted to retrieve the current value of the daily bar you would write
    PHP Code:
    var xHigh high(inv("D"));//this creates the series object of the daily high
    debugPrintln(xHigh.getValue(0));//this will print the current value of the series 
    When you are using the inv() function to define the interval on which a series is based the bar index refers to the external interval and not the chart interval so xHigh.getValue(-1) is the prior day's High, -2 is the daily High of two days ago, etc.
    Hope this helps
    Alex

    Comment

    Working...
    X