Announcement

Collapse
No announcement yet.

Stochastic Histogram

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

  • Stochastic Histogram

    File Name: Stochastic_Histogram.efs

    Description:
    Plots a histogram of the difference between the %K and %D lines.

    Formula Parameters:

    nInputPercentK1: Default is 14
    nInputPercentK2: Default is 1
    nInputPercentD: Default is 3

    Notes:
    Default is for a "Fast Stochastic", but adjusting the nInputPercentK2 to 3 would make this a "Slow Stochastic".

    Download File:
    Stochastic_Histogram.efs

    Image:



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

    var study null;

    function 
    preMain() {

        
    setStudyTitle("Stochastic Histogram");
        
    setCursorLabelName("Hist");
        
        
    // Bands
        
    addBand(0PS_SOLID1Color.black);
        
        
    setDefaultBarFgColor(Color.black);

        
    setPlotType(PLOTTYPE_HISTOGRAM);
        
    }

    function 
    main(nInputPercentK1nInputPercentK2nInputPercentD) {
        
        
    //check for valid inputs
        
    if (nInputPercentK1 == null) {
            
    nInputPercentK1 14;
        }    
        else {
            
    nInputPercentK1 Math.round(nInputPercentK1);
        }

        if (
    nInputPercentK2 == null) {
            
    nInputPercentK2 1;
        }    
        else {
            
    nInputPercentK2 Math.round(nInputPercentK2);
        }
        
            if (
    nInputPercentD == null) {
            
    nInputPercentD 3;
        }    
        else {
            
    nInputPercentD Math.round(nInputPercentD);
        }
        
        
    // Create objects if first time around
        
    if (study == nullstudy = new StochStudy(nInputPercentK1nInputPercentK2nInputPercentD);

        var 
    vFast study.getValue(StochStudy.FAST);
        var 
    vSlow study.getValue(StochStudy.SLOW);
        
        var 
    vHist vFast vSlow;
        
        if (
    vHist 0) {
            
    setBarFgColor(Color.green);
        } else {
            
    setBarFgColor(Color.red);
        }
        
        return 
    vHist;

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