I am trying to determine how to find the value of OHLC/4 of a give bar . I currently use the following and I expect it is not very effecient .
var OValues = new Array(nLength-1);
var HValues = new Array(nLength-1);
var LValues = new Array(nLength-1);
var CValues = new Array(nLength-1);
var yValues = new Array(nLength-1);
OValues = getValue("Open", 0, -Length);
HValues = getValue("High", 0, -Length);
LValues = getValue("Low", 0, -Length);
CValues = getValue("Close", 0, -Length);
if (OValues == null || HValues == null || LValues == null || CValues == null ) {return;}
for (i = 0; i < nLength; ++i)
{yValues[i] = ((OValues[i] + HValues[i] + LValues[i] + CValues[i])/4);}
I would like to replace with this :
yValues = getValue("(O+H+L+C)/4", 0, -Length);
but can't seem to get it to work . Is this possible with the correct syntax of OHLC/4
Thanks
var OValues = new Array(nLength-1);
var HValues = new Array(nLength-1);
var LValues = new Array(nLength-1);
var CValues = new Array(nLength-1);
var yValues = new Array(nLength-1);
OValues = getValue("Open", 0, -Length);
HValues = getValue("High", 0, -Length);
LValues = getValue("Low", 0, -Length);
CValues = getValue("Close", 0, -Length);
if (OValues == null || HValues == null || LValues == null || CValues == null ) {return;}
for (i = 0; i < nLength; ++i)
{yValues[i] = ((OValues[i] + HValues[i] + LValues[i] + CValues[i])/4);}
I would like to replace with this :
yValues = getValue("(O+H+L+C)/4", 0, -Length);
but can't seem to get it to work . Is this possible with the correct syntax of OHLC/4
Thanks
Comment