Announcement

Collapse
No announcement yet.

QCharts_Keltner.efs

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

  • QCharts_Keltner.efs

    File Name: QCharts_Keltner.efs

    Description:
    This is the Keltner study with the same parameter options as the Keltner study from QCharts with the exception of the Volume source.

    Formula Parameters:
    Length: 8
    Source: AvgHLC
    __ [Open, High, Low, Close, AvgHL, AvgHLC, AvgOHLC, AvgOC, AvgHLC]
    Exponential: true
    Bands Color: blue
    Bands Thickness: 1
    Bands Multiplier: 1.3
    Basis Color: red
    Basis Thickness: 1
    Display Basis Line: true

    Notes:
    The bands are based on the average of the High-Low for the same number of periods as specified by the Length parameter multiplied by the Bands Multiplier.


    Download File:
    QCharts_Keltner.efs



    EFS Code:
    PHP Code:
    /*****************************************
    Provided By : eSignal. (c) Copyright 2006
    ******************************************/

    function preMain() {
        
    setPriceStudy(true);
        
    setStudyTitle("QCharts Keltner");
        
    setShowTitleParameters(false);
        
        
    setCursorLabelName("K-Upper"0);
        
    setCursorLabelName("K-Basis"1);
        
    setCursorLabelName("K-Lower"2);

        
    setDefaultBarFgColor(Color.blue0); // upper
        
    setDefaultBarFgColor(Color.red1);  // basis
        
    setDefaultBarFgColor(Color.blue2); // lower
        
        
    var fp1 = new FunctionParameter("nLength"FunctionParameter.NUMBER);
            
    fp1.setName("Length");
            
    fp1.setLowerLimit(1);
            
    fp1.setDefault(8);
        var 
    fp2 = new FunctionParameter("Source"FunctionParameter.STRING);
            
    fp2.setName("Source");
            
    fp2.addOption("Open");
            
    fp2.addOption("High");
            
    fp2.addOption("Low");
            
    fp2.addOption("Close");
            
    fp2.addOption("AvgHL");
            
    fp2.addOption("AvgHLC");
            
    fp2.addOption("AvgOHLC");
            
    fp2.addOption("AvgOC");
            
    fp2.setDefault("AvgHLC");
        var 
    fp3 = new FunctionParameter("bExp"FunctionParameter.BOOLEAN);
            
    fp3.setName("Exponential");
            
    fp3.setDefault(true);
        var 
    fp4 = new FunctionParameter("cBands"FunctionParameter.COLOR);
            
    fp4.setName("Bands Color");
            
    fp4.setDefault(Color.blue);
        var 
    fp5 = new FunctionParameter("nBandThick"FunctionParameter.NUMBER);
            
    fp5.setName("Bands Thickness");
            
    fp5.setLowerLimit(1);
            
    fp5.setDefault(1);
        var 
    fp6 = new FunctionParameter("nMult"FunctionParameter.NUMBER);
            
    fp6.setName("Bands Multiplier");
            
    fp6.setLowerLimit(0);
            
    fp6.setDefault(1.3);
        var 
    fp7 = new FunctionParameter("cBasis"FunctionParameter.COLOR);
            
    fp7.setName("Basis Color");
            
    fp7.setDefault(Color.red);
        var 
    fp8 = new FunctionParameter("nBasisThick"FunctionParameter.NUMBER);
            
    fp8.setName("Basis Thickness");
            
    fp8.setLowerLimit(1);
            
    fp8.setDefault(1);
        var 
    fp9 = new FunctionParameter("bDisplay"FunctionParameter.BOOLEAN);
            
    fp9.setName("Display Basis Line");
            
    fp9.setDefault(true);
    }

    var 
    bInit false;
    var 
    xKeltner null;

    function 
    main(nLengthSourcebExpcBandsnBandThicknMultcBasisnBasisThickbDisplay) {
        if (
    bInit == false) {
            
    xKeltner efsInternal("calcKeltner"nLengthSourcebExpnMult);
            
    setStudyTitle("QCharts Keltner ("nLength ", " Source ", " bExp ", " nMult ")");
            
    setDefaultBarFgColor(cBands0);
            
    setDefaultBarFgColor(cBasis1);
            
    setDefaultBarFgColor(cBands2);
            
    setDefaultBarThickness(nBandThick0);
            
    setDefaultBarThickness(nBasisThick1);
            
    setDefaultBarThickness(nBandThick2);
            
    bInit true;
        }
        
        var 
    nUpper getSeries(xKeltner0);
        var 
    nBasis getSeries(xKeltner1);
        var 
    nLower getSeries(xKeltner2);
        
        if (
    bDisplay == falsenBasis nBasis.toFixed(2);
        
        return new Array(
    nUppernBasisnLower);
    }


    var 
    xSource  null;
    var 
    xBasis   null;
    var 
    xBands   null;
    var 
    xBandSrc null;

    function 
    calcKeltner(nLensrcbn) {
        var 
    nUnBnLnAvgR
        
        
    if (xSource == null) {
            switch (
    src) {
                case 
    "Open"
                    
    xSource open();
                    break;
                case 
    "High"
                    
    xSource high();
                    break;
                case 
    "Low"
                    
    xSource low();
                    break;
                case 
    "Close"
                    
    xSource close();
                    break;
                case 
    "AvgHL"
                    
    xSource hl2();
                    break;
                case 
    "AvgOHLC"
                    
    xSource ohlc4();
                    break;
                case 
    "AvgOC"
                    
    xSource efsInternal("calcOC");
                    break;
                default:
                    
    xSource hlc3();
            }
        }
        
        if (
    xBasis == null) {
            
    xBandSrc efsInternal("calcAvgRange");
            if (
    b) {
                
    xBasis   ema(nLenxSource);
                
    xBands   ema(nLenxBandSrc);
            } else {
                
    xBasis   sma(nLenxSource);
                
    xBands   sma(nLenxBandSrc);
            }
        }
        
        
    nAvgR xBands.getValue(0);
        
    nB    xBasis.getValue(0);
        if (
    nB == null || nAvgR == null) return;
        
        
    nU nB + (nAvgR);
        
    nL nB - (nAvgR);
        
        return new Array(
    nUnBnL);
    }


    function 
    calcOC() {
        return (
    open(0) + close(0)) / 2;
    }

    function 
    calcAvgRange() {
        return (
    high(0) - low(0));

    Jason K.
    Project Manager
    eSignal - an Interactive Data company

    EFS KnowledgeBase
    JavaScript for EFS Video Series
    EFS Beginner Tutorial Series
    EFS Glossary
    Custom EFS Development Policy

    New User Orientation
Working...
X