Announcement

Collapse
No announcement yet.

OutsideBar.efs

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

  • OutsideBar.efs

    File Name: OutsideBar.efs

    Description:
    This study highlights outside bars where the close of the bar is also in the top or bottom 20% of the current bar's range.

    Formula Parameters:
    Color: blue
    Size: 4
    Enable Alerts: true

    Notes:
    If Enable Alerts is set to true, a popup and audible alert will be generated at the completion of the outside bar.

    Download File:
    OutsideBar.efs



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

    function preMain() {
        
    setPriceStudy(true);
        
    setStudyTitle("Outside Bar");
        
    setShowCursorLabel(false);
        
    setShowTitleParameters(false);
        
    setPlotType(PLOTTYPE_CIRCLE0);
        
    setDefaultBarThickness(50);
        
        var 
    fp1 = new FunctionParameter("cColor"FunctionParameter.COLOR);
            
    fp1.setName("Color");
            
    fp1.setDefault(Color.blue);
        var 
    fp2 = new FunctionParameter("nSize"FunctionParameter.NUMBER);
            
    fp2.setName("Size");
            
    fp2.setDefault(4);
        var 
    fp3 = new FunctionParameter("bEnable"FunctionParameter.BOOLEAN);
            
    fp3.setName("Enable Alerts");
            
    fp3.setDefault(true);
    }

    var 
    bInit false;
    var 
    bAlert false;

    function 
    main(cColornSizebEnable) {
        if (
    bInit == false) {
            
    setDefaultBarThickness(nSize0);
            
    setDefaultBarFgColor(cColor0);
        }
        
        if (
    getBarState() == BARSTATE_NEWBAR) {
            if (
    bAlert == true && bEnable == true) {
                
    Alert.playSound("pop.wav");
                
    Alert.addToList(getSymbol(), "Outside Bar"cColorColor.white);
            }
            
    bAlert false;
        }
        
        if (
    high(0) > high(-1) && low(0) < low(-1) ) {
            var 
    nRange = (high(0) - low(0));
            var 
    nTop high(0) - (.2 nRange);
            var 
    nBot low(0) + (.2 nRange);
            
            if (
    close(0) > nTop || close(0) < nBot) {
                
    bAlert true;
            } 
        }
        
        if (
    bAlert == true) {
            return 
    close(0);
        } else {
            return;
        }

    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