Announcement

Collapse
No announcement yet.

Inside Bar Indicator

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

  • Inside Bar Indicator

    Hello

    I'm looking for a study that will identify 'inside bars' defined as a bar whose high/low range is inside or equal to that of the previous bars high/low (i.e. .L1<=L and H<=H1)



    I previously used RealTick, which had a build in condition that would place a yellow dot below any candlestick that was an inside bar

    Any help would be appreciated.

    Cheers.

  • #2
    I picked this up somewhere. See if it works for you. It marks the close of the inside bar with a dot and has menu options for the color and size of the dot and for a sound and list alert.
    PHP Code:
    function preMain() {
        
    setPriceStudy(true);
        
    setStudyTitle("Insidebar");
        
    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 && bEnable) {
                
    Alert.playSound("pop.wav");
                
    Alert.addToList(getSymbol(), "Insidebar"cColorColor.white);
            }
            
    bAlert false;
        }

        if (
    high(0) < high(-1) && low(0) > low(-1) ) {
            
    bAlert true;
        } else {
            
    bAlert false;
        }
        if (
    bAlert) {
            return 
    close(0);
        } else {
            return;
        }

    wayne

    Comment

    Working...
    X