Announcement

Collapse
No announcement yet.

Can't Insert Study over EFS generated series

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

  • Can't Insert Study over EFS generated series

    Hey there. I am building a script that takes the main chart symbol and adds it to a user defined symbol in a sub chart. It takes the main symbol divided by SPY as an example and charts a line chart. Here is the issue: I cannot insert a study onto the user defined chart. If I insert a symbol (not as main chart) and use the same symbols to create a user defined symbol I am able to insert a study.

    Example - main chart symbol = EA, user defined symbol would then be EA / SPY. If I insert the symbol manually I can place Bollinger Bands on the sub-chart "EA / SPY". If I do the same thing using an EFS script, I don't have the option to insert a study over the series. I've tried two versions of code to create the user defined symbol - with the same results. I get the desired line chart, but cannot place a study on it.

    Any suggestions?

    EFS attempt # 1:
    function preMain(){

    setStudyTitle("i3 Exchange Comparison");
    setCursorLabelName("Exchange");
    setPriceStudy(false);
    setDefaultBarFgColor(Color.RGB(0x00,0x94,0xFF),0);
    setDefaultBarThickness(3,0);
    }

    var vSymbol;
    var SourceSymbol;
    var CompareSymbol;

    function main(Sym){

    var SourceSymbol = getSymbol();
    var CompareSymbol = "SPY";
    var vSym = (SourceSymbol + " / " + CompareSymbol);
    var Sym = vSym;
    var vSymbol = getValue("Close", 0, -1, Sym);

    debugClear
    debugPrintln("DepthSymbol: " + SourceSymbol);
    debugPrintln("Base Comparison to: " + CompareSymbol);

    return vSymbol;
    }

    Attempt # 2:
    **************************************
    function preMain(){

    setStudyTitle("i3 Exchange Comparison");
    setCursorLabelName("Exchange");
    //setPriceStudy(false);
    setDefaultBarFgColor(Color.RGB(0x00,0x94,0xFF),0);
    setDefaultBarThickness(3,0);

    }

    var vSymbol;
    var SourceSymbol;
    var CompareSymbol;
    var vSym;

    function main() {

    var SourceSymbol = getSymbol();
    var CompareSymbol = "SPY";
    var vSym = (SourceSymbol + " / " + CompareSymbol);
    var vSymbol = close(sym(vSym));

    return new Array( getSeries(vSymbol));
    }
    Last edited by mpetroski; 03-13-2016, 08:51 PM.

  • #2
    mpetroski
    The Study over Series and the Apply Study to (Study) functionality are only available for [respectively] an actual Chart of a symbol or a Built-in Study and not for EFS scripts
    To add a study to the plot created by your script [which is not a chart in the true sense of the word] you need to code that in the script itself or code another script that calls it
    Alex


    Originally posted by mpetroski View Post
    Hey there. I am building a script that takes the main chart symbol and adds it to a user defined symbol in a sub chart. It takes the main symbol divided by SPY as an example and charts a line chart. Here is the issue: I cannot insert a study onto the user defined chart. If I insert a symbol (not as main chart) and use the same symbols to create a user defined symbol I am able to insert a study.

    Example - main chart symbol = EA, user defined symbol would then be EA / SPY. If I insert the symbol manually I can place Bollinger Bands on the sub-chart "EA / SPY". If I do the same thing using an EFS script, I don't have the option to insert a study over the series. I've tried two versions of code to create the user defined symbol - with the same results. I get the desired line chart, but cannot place a study on it.

    Any suggestions?

    EFS attempt # 1:
    function preMain(){

    setStudyTitle("i3 Exchange Comparison");
    setCursorLabelName("Exchange");
    setPriceStudy(false);
    setDefaultBarFgColor(Color.RGB(0x00,0x94,0xFF),0);
    setDefaultBarThickness(3,0);
    }

    var vSymbol;
    var SourceSymbol;
    var CompareSymbol;

    function main(Sym){

    var SourceSymbol = getSymbol();
    var CompareSymbol = "SPY";
    var vSym = (SourceSymbol + " / " + CompareSymbol);
    var Sym = vSym;
    var vSymbol = getValue("Close", 0, -1, Sym);

    debugClear
    debugPrintln("DepthSymbol: " + SourceSymbol);
    debugPrintln("Base Comparison to: " + CompareSymbol);

    return vSymbol;
    }

    Attempt # 2:
    **************************************
    function preMain(){

    setStudyTitle("i3 Exchange Comparison");
    setCursorLabelName("Exchange");
    //setPriceStudy(false);
    setDefaultBarFgColor(Color.RGB(0x00,0x94,0xFF),0);
    setDefaultBarThickness(3,0);

    }

    var vSymbol;
    var SourceSymbol;
    var CompareSymbol;
    var vSym;

    function main() {

    var SourceSymbol = getSymbol();
    var CompareSymbol = "SPY";
    var vSym = (SourceSymbol + " / " + CompareSymbol);
    var vSymbol = close(sym(vSym));

    return new Array( getSeries(vSymbol));
    }

    Comment


    • #3
      Thanks for your reply - I will try to script the study.

      Comment


      • #4
        mpetroski
        You are welcome
        Alex


        Originally posted by mpetroski View Post
        Thanks for your reply - I will try to script the study.

        Comment

        Working...
        X