Announcement

Collapse
No announcement yet.

StochRSI Color Line Bar

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

  • StochRSI Color Line Bar

    Is it possible to build an EFS, like the RSI color line Bar in Esignal's Helpers Folder? But instead of using RSI, use Stoch RSI. Default value (4). If equal to Zero turn RED, If above Zero turn Green.
    Here is the RSI efs.
    Thanks for your time...Greg
    /************************************************** **************************************************
    Copyright © eSignal, a division of Interactive Data Corporation. 2006. All rights reserved.
    This sample eSignal Formula Script (EFS) may be modified and saved under a new
    filename; however, eSignal is no longer responsible for the functionality once modified.
    eSignal reserves the right to modify and overwrite this EFS file with each new release.
    ************************************************** ************************************************** */

    function preMain() {
    /* Set the title that will appear in the study pane */
    setStudyTitle("RSI Color Line Bar");

    /* Set the label that will appear in the cursor window */
    setCursorLabelName("RSI clb", 0);

    /* Force the scale to be 0->100 */
    setStudyMin(0);
    setStudyMax(100);

    /* Add Bands to appear in the study window */
    addBand(30, PS_SOLID, 1, Color.RGB(0,0,0), "a");
    addBand(65, PS_SOLID, 1, Color.RGB(0,0,0), "b");

    var fp1 = new FunctionParameter("nInputLength", FunctionParameter.NUMBER);
    fp1.setName("RSI Length");
    fp1.setLowerLimit(1);
    fp1.setDefault(4);
    }

    var vValue = null;

    function main(nInputLength) {
    if (vValue == null) {
    vValue = efsExternal("/library/RSIStandard.efs", nInputLength);
    }

    var nValue = vValue.getValue(0);
    if (nValue == null) return;

    /*
    * This is optional. You can set properties for each bar.
    */
    if(nValue >= 1) {
    setBarStyle(PS_SOLID);
    setBarThickness(2);
    setBarFgColor(Color.black);
    setBarBgColor(Color.lime);
    } else if(nValue = 0) {
    setBarStyle(PS_SOLID);
    setBarThickness(2);
    setBarFgColor(Color.black);
    setBarBgColor(Color.red);
    }

    /*
    * The return value is what will be plotted the chart.
    */
    return (nValue);
    }

  • #2
    Re: StochRSI Color Line Bar

    Greg
    Use the StochRSI that is provided in the Library folder and add the followng lines of code just above the return statement
    Alex

    PHP Code:
    if(vStochRSI==0){
            
    setBarFgColor(Color.red);
        }else if(
    vStochRSI>0) {
            
    setBarFgColor(Color.green)
        } 

    Originally posted by gwika
    Is it possible to build an EFS, like the RSI color line Bar in Esignal's Helpers Folder? But instead of using RSI, use Stoch RSI. Default value (4). If equal to Zero turn RED, If above Zero turn Green.
    Here is the RSI efs.
    Thanks for your time...Greg
    /************************************************** **************************************************
    Copyright © eSignal, a division of Interactive Data Corporation. 2006. All rights reserved.
    This sample eSignal Formula Script (EFS) may be modified and saved under a new
    filename; however, eSignal is no longer responsible for the functionality once modified.
    eSignal reserves the right to modify and overwrite this EFS file with each new release.
    ************************************************** ************************************************** */

    function preMain() {
    /* Set the title that will appear in the study pane */
    setStudyTitle("RSI Color Line Bar");

    /* Set the label that will appear in the cursor window */
    setCursorLabelName("RSI clb", 0);

    /* Force the scale to be 0->100 */
    setStudyMin(0);
    setStudyMax(100);

    /* Add Bands to appear in the study window */
    addBand(30, PS_SOLID, 1, Color.RGB(0,0,0), "a");
    addBand(65, PS_SOLID, 1, Color.RGB(0,0,0), "b");

    var fp1 = new FunctionParameter("nInputLength", FunctionParameter.NUMBER);
    fp1.setName("RSI Length");
    fp1.setLowerLimit(1);
    fp1.setDefault(4);
    }

    var vValue = null;

    function main(nInputLength) {
    if (vValue == null) {
    vValue = efsExternal("/library/RSIStandard.efs", nInputLength);
    }

    var nValue = vValue.getValue(0);
    if (nValue == null) return;

    /*
    * This is optional. You can set properties for each bar.
    */
    if(nValue >= 1) {
    setBarStyle(PS_SOLID);
    setBarThickness(2);
    setBarFgColor(Color.black);
    setBarBgColor(Color.lime);
    } else if(nValue = 0) {
    setBarStyle(PS_SOLID);
    setBarThickness(2);
    setBarFgColor(Color.black);
    setBarBgColor(Color.red);
    }

    /*
    * The return value is what will be plotted the chart.
    */
    return (nValue);
    }

    Comment

    Working...
    X