Announcement

Collapse
No announcement yet.

help accessing global array..

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

  • help accessing global array..

    Hi, I'm declaring an array with a global scope, filling with data from end to the beginning ie using the absolute value of the value returned from the function getCurrentBarIndex().....

    I can't seem to access the data...
    Here's a sample:

    var vArrayglobal = new Array (cArrywidth , cArrysze );


    function preMain() {

    }


    function main() {
    nIndex = getCurrentBarIndex();
    var nAbsIndex = Math.abs(nIndex);

    const cOffset1 = 1;

    // avoid the 1st and 2nd items since they don't provide data
    var nMaxIndex = getNumBars() - 3;

    vArrayglobal[nAbsIndex] = [high(), low(), close()];

    //if we are the beginning then can't get any items before it
    if( nAbsIndex - cOffset1 <= nMaxIndex )
    {
    // doesn't work here
    vArrayglobal[nAbsIndex][3] =
    vArrayglobal[nAbsIndex+cOffset1][0];
    //should of been able to get the previous item
    }

    }

    any help would be kindly appreciated....
    thanks

  • #2
    Hi kp,

    the method in which you are declaring the array is not valid in JavaScript. Take a look at this file, it is a primer on setting up arrays

    http://share.esignal.com/ContentRoot...ing+Arrays.efs

    edit - try this link, the other is not working on my end

    http://share.esignal.com/groupconten...ys&groupid=339
    Last edited by Guest; 05-02-2005, 10:42 AM.

    Comment


    • #3
      thanks

      Hey Steve

      I looked at the link that you sent and found it to do the trick... Having never done javascript before it was a great help. Thanks for the response...

      Comment

      Working...
      X