The code -getValue("High",0,-5);- retrieves the last 5 highs of the charts symbol and interval.
But there doesn’t seem to be a way to get those same values for a different symbol and/or interval.
For example: using -sym(“symbol, interval”)-
The code below outputs:
1168.75,1168.75,1169,1169,1169 -v- 1168.75 -x
Where - getValue("High",0,-5);- outputs five values but high(0,-5, sym(xSymbol));- outputs only one (see debugPrint in the code below).
Article # 1068 of the knowledge base has the syntax for high() as - high([nRelativeOffset] [, nNumBars [, Symbol ] ])- where nNumBars: Number of bars to retrieve (a negative number) with the example:
-high(0, -10, "INTC"); gets the last 10 highs for INTC and places them in an array-
Thanks in advance.
Wayne
But there doesn’t seem to be a way to get those same values for a different symbol and/or interval.
For example: using -sym(“symbol, interval”)-
The code below outputs:
1168.75,1168.75,1169,1169,1169 -v- 1168.75 -x
Where - getValue("High",0,-5);- outputs five values but high(0,-5, sym(xSymbol));- outputs only one (see debugPrint in the code below).
Article # 1068 of the knowledge base has the syntax for high() as - high([nRelativeOffset] [, nNumBars [, Symbol ] ])- where nNumBars: Number of bars to retrieve (a negative number) with the example:
-high(0, -10, "INTC"); gets the last 10 highs for INTC and places them in an array-
PHP Code:
var bInit = false;
var xSymbol = null;
var vSymbol = null;
var Interval0 = 3;
function main(){
if(bInit == false){
if(vSymbol == null || vSymbol == "") vSymbol = getSymbol();
if(Interval0 == "Default" || Interval0 == null) Interval0 = getInterval();
xSymbol = vSymbol+","+Interval0;
bInit = true;
}
var vHigh = getValue("High",0,-5);
var xHigh = high(0,-5, sym(xSymbol));
debugPrintln(vHigh+" -v- "+xHigh+" -x");
}
Wayne
Comment