Announcement

Collapse
No announcement yet.

Retrieving multiple values for a data series

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

  • Retrieving multiple values for a data series

    Hi,

    Is there a way to retrieve [with one call] multiple bars value for a declared data series/study?

    getValue accepts only close, open high, low, etc. but not regular studies. I tried what I thought it should/might work but did not:
    myArray = getValue(stMA1, refBar, numBars);
    Error Message: Unidentified Series.

    Apparently, there is no "numBars" parameter in the study.getValue function.

    Thank you
    Last edited by mbuta; 09-04-2006, 05:34 PM.
    Mihai Buta

  • #2
    Re: Retrieving multiple values for a data series

    Hello Mihai,

    Originally posted by mbuta
    Hi,

    Is there a way to retrieve [with one call] multiple bars value for a declared data series/study?

    getValue accepts only close, open high, low, etc. but not regular studies. I tried what I thought it should/might work but did not:
    myArray = getValue(stMA1, refBar, numBars);
    Error Message: Unidentified Series.

    Apparently, there is no "numBars" parameter in the study.getValue function.

    Thank you
    In this example you are talking about two different things, which may be why you are confused. Prior to EFS2 we had the getValue() function, which is still available. However, it is a stand alone EFS1 function that only accepts the following bar types for the first parameter. It cannot be used in conjunction with an EFS2 Series such as your stMA1 series.

    "open", "high", "low", "close", "time", "rawtime", "volume", "oi", "year", "month", "day", "hour", "minute", "second"


    With the introduction of EFS2, the Series object also has a method available that has the same name but is not the same functionality as the stand alone getValue() function. To use the .getValue() method in conjunction with an EFS2 Series, it must be in the following form.

    mySeriesObject.getValue(...params...);

    To answer your specific question; "Is there a way to retrieve [with one call] multiple bars value for a declared data series/study?"

    No, there isn't. The reason we had this type of functionality prior to EFS2 was because users needed to create arrays of the type of data you are trying to create so that they could loop through the array and perform various calculations. We don't need this functionality anymore with EFS2 Series because they are already an array. If you need to loop through a certain number of values of the Series you can just reference the bar values you need with the .getValue() method directly instead of creating a separate array and then looping through it.

    This assumes stMA1 is assigned to a Series of sma(10).

    PHP Code:
    var nSum 0;
    for (var 
    = -1>= -10i--) {
        
    nSum += stMA1.getValue(i);

    In this example nSum would be the total of the previous 10 bars sma values.

    If there is some other reason why you need the values in a regular JavaScript array object, please describe more specificly what you are trying to accomplish.
    Jason K.
    Project Manager
    eSignal - an Interactive Data company

    EFS KnowledgeBase
    JavaScript for EFS Video Series
    EFS Beginner Tutorial Series
    EFS Glossary
    Custom EFS Development Policy

    New User Orientation

    Comment


    • #3
      Hi Jason,

      Thank you for the detailed reply, now I understand [that I cannot do it, that way, or maybe is a non-issue, will check].

      Here is why I needed that functionality:
      I calculate the Myrsi(MyOsc(MA1,MA2)) internally, because:
      a/ there is no simple built-in Osc function [nor macd(simpleMA's)], and
      b/ I avoid efsInternal [performance issues we discussed before].

      This means that MyRSI() will generate a call to MyOsc() for every bar in RSI calculation, and that is slow.
      I want to avoi that by creating a special function MyOscRSI(stMA1,stMA2) and I am looking to bring MA's values all at once [to save time].
      From what you say, it seems that I don't need to worry about it.
      I will try.

      Thanks again.
      Last edited by mbuta; 09-05-2006, 03:52 PM.
      Mihai Buta

      Comment


      • #4
        You're most welcome.
        Jason K.
        Project Manager
        eSignal - an Interactive Data company

        EFS KnowledgeBase
        JavaScript for EFS Video Series
        EFS Beginner Tutorial Series
        EFS Glossary
        Custom EFS Development Policy

        New User Orientation

        Comment

        Working...
        X