P.P.S. This is a 2nd edit.
The code shown below boils down to the question "are the following 4 statements in the code shown below valid for storing and retrieving array elements"?
MyArray[DAY_NUM,1] = day_date;
MyArray[DAY_NUM,2] = open(0);
array_element = MyArray[x,1];
array_element = MyArray[x,2];
P.S. This is an edit: I think maybe I should have submitted this to the EFS studies forum. Sorry about that.
/* Am I using valid array logic?
I am trying to access MyArray by row number and column number
so I tried the following test which did not work (i.e) the element
values retrieved in the "display array values" loop are unchanged
and are the last day values repeated over and over again for the
entire loop.
The elements displayed in the Formula Output window are (for all 54 days)
row54,column1 = 5/2/2008
row54,column2 = 49.19
*/
MyArray = new Array();
var x;
var array_element;
var DAY_NUM=0;
function preMain()
{
setPriceStudy(true);
setStudyTitle("SHORT DEBUG TEST")
setCursorLabelName("open", 0);
}
function main()
{
if (getBarState() == BARSTATE_NEWBAR) DAY_NUM=DAY_NUM+1;
var day_date=month(0)+"/"+day(0)+"/"+year(0);
MyArray[DAY_NUM,1] = day_date;
MyArray[DAY_NUM,2] = open(0);
if(DAY_NUM==54) //display array values
//if(isLastBarOnChart)
{
for (x=0; x<=DAY_NUM; x++)
{
array_element = MyArray[x,1];
debugPrint("row"+DAY_NUM+",column1 = "+array_element+"\n");
array_element = MyArray[x,2];
debugPrint("row"+DAY_NUM+",column2 = "+array_element.toFixed(2)+"\n");
}
}
return open(0);
}
The code shown below boils down to the question "are the following 4 statements in the code shown below valid for storing and retrieving array elements"?
MyArray[DAY_NUM,1] = day_date;
MyArray[DAY_NUM,2] = open(0);
array_element = MyArray[x,1];
array_element = MyArray[x,2];
P.S. This is an edit: I think maybe I should have submitted this to the EFS studies forum. Sorry about that.
/* Am I using valid array logic?
I am trying to access MyArray by row number and column number
so I tried the following test which did not work (i.e) the element
values retrieved in the "display array values" loop are unchanged
and are the last day values repeated over and over again for the
entire loop.
The elements displayed in the Formula Output window are (for all 54 days)
row54,column1 = 5/2/2008
row54,column2 = 49.19
*/
MyArray = new Array();
var x;
var array_element;
var DAY_NUM=0;
function preMain()
{
setPriceStudy(true);
setStudyTitle("SHORT DEBUG TEST")
setCursorLabelName("open", 0);
}
function main()
{
if (getBarState() == BARSTATE_NEWBAR) DAY_NUM=DAY_NUM+1;
var day_date=month(0)+"/"+day(0)+"/"+year(0);
MyArray[DAY_NUM,1] = day_date;
MyArray[DAY_NUM,2] = open(0);
if(DAY_NUM==54) //display array values
//if(isLastBarOnChart)
{
for (x=0; x<=DAY_NUM; x++)
{
array_element = MyArray[x,1];
debugPrint("row"+DAY_NUM+",column1 = "+array_element+"\n");
array_element = MyArray[x,2];
debugPrint("row"+DAY_NUM+",column2 = "+array_element.toFixed(2)+"\n");
}
}
return open(0);
}
Comment