Announcement

Collapse
No announcement yet.

RSI w/ Bands

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • RSI w/ Bands

    File Name: RSI_w_Bands.efs

    Description:
    Displays RSI with Bollinger Bands applied
    to the RSI study.

    Formula Parameters:

    nRSILength - Length of RSI (Default: 14)
    nRSISource - Source for RSI (Default: "Close")
    nBandLength - Length of Bollinger Bands (Default: 50)
    nStdDev - Standard Deviations for BB (Default: 2.1)

    Notes:
    Valid inputs for nRSISource: Open, High, Low, Close, HL/2, HLC/3 and OHLC/4

    Download File:
    RSI_w_Bands.efs




    EFS Code:
    PHP Code:
    /************************
    Copyright © eSignal, 2003
    *************************

    Description: Displays RSI with Bollinger Bands applied
    to the RSI study.

    Inputs:
    nRSILength - Length of RSI (Default: 14)
    nRSISource - Source for RSI (Default: "Close")
    nBandLength - Length of Bollinger Bands (Default: 50)
    nStdDev - Standard Deviations for BB (Default: 2.1)

    */

    var study null;
    var 
    study2 null;

    function 
    preMain() {
        
    setDefaultBarFgColor(Color.blue0); // upper
        
    setDefaultBarFgColor(Color.red1); // basis
        
    setDefaultBarFgColor(Color.blue2); // lower
        
        
    setStudyTitle("RSI w/ Bands");
        
    setCursorLabelName("Upper",0);
        
    setCursorLabelName("Basis",1);
        
    setCursorLabelName("Lower",2);
        
    setCursorLabelName("RSI",3);    
        
        
    setDefaultBarFgColor(Color.blue,0);
        
    setDefaultBarFgColor(Color.red,1);
        
    setDefaultBarFgColor(Color.blue,2);
        
    setDefaultBarFgColor(Color.aqua,3);
    }

    function 
    main(nRSILength,nRSISource,nBandLength,nStdDev) {

        if (
    nRSILength == nullnRSILength 14;
        if (
    nRSISource == nullnRSISource verifySource(nRSISource);
        if (
    nBandLength == nullnBandLength 50;
        if (
    nStdDev == nullnStdDev 2.1;

        if (
    study == nullstudy = new RSIStudy(nRSILengthnRSISource);
        if (
    study2 == nullstudy2 = new BollingerStudy(nBandLengthstudyRSIStudy.RSInStdDev)

        var 
    vRSI   study.getValue(RSIStudy.RSI);
        var 
    vUpper study2.getValue(BollingerStudy.UPPER);
        var 
    vBasis study2.getValue(BollingerStudy.BASIS);
        var 
    vLower study2.getValue(BollingerStudy.LOWER);
        
        
        return new Array(
    vUppervBasisvLowervRSI);
    }

    /*** Utility Function ***/
    // Verifies source input and returns valid source


    function verifySource(nSource) {
        
        if (
    nSource == "close" || nSource =="C" || 
            
    nSource =="Close" || nSource =="c") {
                
    nSource "Close";
                
        } else if (
    nSource == "open" || nSource =="O" || 
            
    nSource =="Open" || nSource =="o") {
                
    nSource "Open";
                
        } else if (
    nSource == "high" || nSource =="H" || 
            
    nSource == "High" || nSource == "h") {
                
    nSource "High";
                
        } else if (
    nSource == "low" || nSource =="L" || 
            
    nSource =="Low" || nSource =="l") {
                
    nSource "Low";
                
        } else if (
    nSource == "hl/2" || nSource =="HL2" || 
            
    nSource =="HL/2" || nSource =="hl2") {
                
    nSource "HL/2";
                
        } else if (
    nSource == "hlc/3" || nSource =="hlc3" || 
            
    nSource =="HLC/3" || nSource =="HLC3") {
                
    nSource "HLC/3";
                
        } else if (
    nSource == "ohlc/4" || nSource =="ohlc4" || 
            
    nSource =="OHLC/4" || nSource =="OHLC4") {
                
    nSource "OHLC/4";
                
        } else {
                
    nSource "Close";
        }
        
        return 
    nSource;

    Regards,
    Jay F.
    Product Manager
    _____________________________________
    Have a suggestion to improve our products?
    Click Support --> Request a Feature in eSignal 11
Working...
X