Announcement

Collapse
No announcement yet.

Using Sym and FunctionParameter

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

  • Using Sym and FunctionParameter

    I wanted to use the FunctionParameter to change symbols. I tried it and somehow did not get the results I expected. Any help would be appreciated.

    PHP Code:
    function preMain() {

    var 
    fp = new FunctionParameter("nSymb"FuntionParameter.STRING);
    fp.setName("symbol");
    fp.addOption("ES Z7=2");

    .....
    var 
    bInit false;
    function 
    Main (nSymb){

    if (
    bInit == false){
     
    dHigh high(sym("nSymb,D"));
    bInit true;
    }

    varHi dHigh.getValue(0);
    varHi2 =dHigh.getValue(-1);
    .....
    return 
    varHi varHi2 ...; 

  • #2
    Re: Using Sym and FunctionParameter

    akiri
    Replace dHigh = high(sym("nSymb,D")); with dHigh = high(sym(nSymb+",D"));
    Note however that you have other errors in the script you posted such as Main instead of main and FuntionParameter instead of FunctionParameter
    For a complete example of how to use the FunctionParameter object with sym() or inv() see any one of the scripts provided in the EFS2 Custom folder as these are all enabled for multiple symbols and/or intervals
    Alex


    Originally posted by akiri
    I wanted to use the FunctionParameter to change symbols. I tried it and somehow did not get the results I expected. Any help would be appreciated.

    PHP Code:
    function preMain() {

    var 
    fp = new FunctionParameter("nSymb"FuntionParameter.STRING);
    fp.setName("symbol");
    fp.addOption("ES Z7=2");

    .....
    var 
    bInit false;
    function 
    Main (nSymb){

    if (
    bInit == false){
     
    dHigh high(sym("nSymb,D"));
    bInit true;
    }

    varHi dHigh.getValue(0);
    varHi2 =dHigh.getValue(-1);
    .....
    return 
    varHi varHi2 ...; 

    Comment

    Working...
    X