Greetings,
I'd like build one function that recieves one parameter like "SourcePrice" (i.e hl2, hlc3, ...), and returns one array with the complete serie, for educational purposes.
The code that I have developed doesn't work. Only returns one value.
Could you help me, please ? Thanks very much.
I'd like build one function that recieves one parameter like "SourcePrice" (i.e hl2, hlc3, ...), and returns one array with the complete serie, for educational purposes.
The code that I have developed doesn't work. Only returns one value.
Could you help me, please ? Thanks very much.
PHP Code:
/************************************************************************
* Ejemplos para elegir el tipo de precio
* Los precios posibles son: close open high low hl2 hlc3 ohlc4
*************************************************************************/
function preMain() {
setPriceStudy(false);
setStudyTitle("PriceSource");
var Param1 = new FunctionParameter("sSource",
FunctionParameter.STRING);
Param1.setDefault("hl2");
}
function main(sSource){
if ( sSource == null ) sSource = "hl2";
//I like get one array with ten previous values
var a = eval( sSource+"().getValue(0,-10)");
if ( a == null ) return null;
return new Array( a[0], a[1]); // <<< DON'T WORK !!!
//var b = getSeries(a); // <<< That doesn´t work neither
}
Comment