Announcement

Collapse
No announcement yet.

is getvalue(0) taking more resources?

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

  • is getvalue(0) taking more resources?

    1) Comparing the 2 approachs below, which one is more draining more resources?

    A) To Create a Series
    var myStudy1 = null;
    var bInit = false;
    function main() {
    var myVar1;
    if ( bInit == false ) {
    myStudy1 = ema( 20 );
    bInit = true;
    }
    //retrieve the current values
    myVar1 = myStudy1.getValue(0);
    return myVar1;
    }

    B) To Retrieve a Single Value
    function main() {
    ...
    ...
    myVar = sma( 10 );
    //do something with the value in myVar
    }

    What I want is to calculate the EMAs of 10min, 30min and 60min, daily, and weekly in an EFS. And I will open all of these charts with the EFS loaded in each one of them. It takes quite a long time to load and I wonder if there is anyway to speed it up.

    2) Also, if I hv already loaded the EFS in one timeframe, will it be using the same amt or less amt of resources to load the same EFS in another timeframe. I hv already "hardwired" the interval using inv() in it and so all charts are just making sure same set of data.

    thx
    Last edited by Richard Yu; 07-31-2005, 02:13 AM.

  • #2
    Richard
    Setting aside the fact that the difference between those two examples is going to be within fractions of a millisecond on average - so for all intents and purposes virtually unnoticeable - the first option (A) is going to be slightly more efficient.
    As to your second question it is going to take the same amount of resources. Every time you call an external interval in any efs it will be like calling a chart for that interval and running the indicator on it. However the load times may vary as those depend on the amount of data being requested. Without seeing your efs I can only suggest that you limit the amount of data being loaded in your charts.
    Alex

    Comment

    Working...
    X