Announcement

Collapse
No announcement yet.

keltner bands

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

  • keltner bands

    PHP Code:
    /**
    Copyright © eSignal, a division of Interactive Data Corporation. 2002. 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() {
        
    setPriceStudy(true);
        
        
    /* Set the title that will appear in the study pane */
        
    setStudyTitle("Keltner");

        
    /* Set the label that will appear in the cursor window */
        
    setCursorLabelName("K-Upper"0);
        
    setCursorLabelName("K-Basis"1);
        
    setCursorLabelName("K-Lower"2);

        
    setDefaultBarFgColor(Color.blue0); // upper
        
    setDefaultBarFgColor(Color.red1); // basis
        
    setDefaultBarFgColor(Color.blue2); // lower
    }


    function 
    main(nInputLength) {
        if(
    nInputLength == null)
            
    nInputLength 1.3;
        if(
    nInputLength <= 16)
            
    nInputLength 1.3;


        var 
    dHigh high(0, -nInputLength);
        var 
    dLow low(0, -nInputLength);
        var 
    dKeltnerBasiscall("KeltnerEMA.efs"nInputLength);
        if(
    dHigh == null || dLow == null || dKeltnerBasis == null)
            return;

        var 
    dHminL 0;
        var 
    i;

        for(
    0nInputLengthi++) {
            
    dHminL += dHigh[i] - dLow[i];
        }

        
    dHminL /= nInputLength;


        return new Array(
    dKeltnerBasis dHminLdKeltnerBasisdKeltnerBasis dHminL);

    I would like to change the setting of the study. I would like the upper and lower bands at 1.3 multiplier, and the mid band at 16. I tried to change the ninputs but it give me an error. Can you help me fix this please?

  • #2
    chevymike
    Replace the following section of code
    PHP Code:
    if(nInputLength == null)
    nInputLength 1.3;
    if(
    nInputLength <= 16)
    nInputLength 1.3
    with
    PHP Code:
    if(nInputLength == null)
    nInputLength 16
    and replace the return statement with the following.
    PHP Code:
    return new Array(dKeltnerBasis + (dHminL*1.3), dKeltnerBasisdKeltnerBasis - (dHminL*1.3)); 
    FYI you can find here a Keltner Channel script that already includes a user definable parameter for the multiplier of the bands
    Alex

    Comment

    Working...
    X