Announcement

Collapse
No announcement yet.

Highlight Help

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

  • Highlight Help

    Hello

    I'm trying to place highlight between the two lines (Bollinger bands lines) like the picture attached. The two lines are offset 10 places forward.

    Can it be done

    Thank you

    Aquilhm

    Click image for larger version

Name:	BB.png
Views:	1
Size:	28.4 KB
ID:	246873
    Attached Files
    Last edited by aquilhm; 03-18-2013, 08:47 AM.

  • #2
    Try,
    PHP Code:
    /*****************************************************************
    Provided By:                                                      
        Interactive Data Corporation (Copyright © eSignal) 2010.      
        All rights reserved. This sample eSignal Formula Script (EFS) 
        is for educational purposes only. Interactive Data Corporation
        reserves the right to modify and overwrite this EFS file with 
        each new release.                                             
    ******************************************************************/
    //20130321 added extension lines && shading
    var fpArray = new Array();

    function 
    preMain() {

        
    setPriceStudy(true);
        
    setStudyTitle("Bollinger Bands");
        
    setCursorLabelName("UprBB"0);
        
    setCursorLabelName("BasBB"1);
        
    setCursorLabelName("LwrBB"2);
        
    setDefaultBarFgColor(Color.RGB(0x00,0x94,0xFF), 0);
        
    setDefaultBarFgColor(Color.RGB(0xFE,0x69,0x00), 1);
        
    setDefaultBarFgColor(Color.RGB(0x00,0x94,0xFF), 2);
        
    setPlotType(PLOTTYPE_LINE,0);
        
    setPlotType(PLOTTYPE_LINE,1);
        
    setPlotType(PLOTTYPE_LINE,2);
        
    setDefaultBarThickness(1,0);
        
    setDefaultBarThickness(1,1);
        
    setDefaultBarThickness(1,2);
        
    askForInput();
            
        var 
    x=0;
        
    fpArray[x] = new FunctionParameter("Length"FunctionParameter.NUMBER);
        
    with(fpArray[x++]){
            
    setLowerLimit(1);        
            
    setDefault(20);
        }
        
    fpArray[x] = new FunctionParameter("StdDev"FunctionParameter.NUMBER);
        
    with(fpArray[x++]){
            
    setLowerLimit(0);    
            
    setDefault(2);
        }
        
    fpArray[x] = new FunctionParameter("Source"FunctionParameter.STRING);
        
    with(fpArray[x++]){
            
    addOption("open"); 
            
    addOption("high");
            
    addOption("low");
            
    addOption("close");
            
    addOption("hl2");
            
    addOption("hlc3");
            
    addOption("ohlc4"); 
            
    setDefault("close"); 
        }
        
    fpArray[x] = new FunctionParameter("Symbol"FunctionParameter.STRING);
        
    with(fpArray[x++]){
            
    setDefault();
        }
        
    fpArray[x] = new FunctionParameter("Interval"FunctionParameter.STRING);
        
    with(fpArray[x++]){
            
    setDefault();
        }
        
    fpArray[x] = new FunctionParameter("Offset"FunctionParameter.NUMBER);
        
    with(fpArray[x++]){
            
    setDefault(10);
        }
        
    fpArray[x] = new FunctionParameter("PlotUp_Lo_BB"FunctionParameter.BOOLEAN);
        
    with(fpArray[x++]){
            
    setDefault(true);
        }
        
    fpArray[x] = new FunctionParameter("PlotMidBB"FunctionParameter.BOOLEAN);
        
    with(fpArray[x++]){
            
    setDefault(true);
        }
        
    fpArray[x] = new FunctionParameter("BgColor"FunctionParameter.COLOR);
        
    with(fpArray[x++]){
            
    setDefault(Color.RGB(130,245,255));
        }
        
    fpArray[x] = new FunctionParameter("Params"FunctionParameter.BOOLEAN);
        
    with(fpArray[x++]){
            
    setName("Show Parameters");
            
    setDefault(false);
        }
    }

    var 
    bInit false;
    var 
    xUpBB null;
    var 
    xMidBB null;
    var 
    xLoBB null;

    function 
    main(Length,StdDev,Source,Symbol,Interval,Offset,PlotUp_Lo_BB,PlotMidBB,BgColor,Params) {
        var 
    minTick=getMinTick();
        var 
    valUp,valLo,pUp,pLo,xOff;
        if(
    bInit == false){
            if(
    Symbol == nullSymbol getSymbol();
            if(
    Interval == nullInterval getInterval();
            var 
    vSymbol Symbol+","+Interval;
            
    xUpBB offsetSeries(upperBB(Length,StdDev,eval(Source)(sym(vSymbol))),Offset);
            
    xMidBB offsetSeries(middleBB(Length,StdDev,eval(Source)(sym(vSymbol))),Offset);
            
    xLoBB offsetSeries(lowerBB(Length,StdDev,eval(Source)(sym(vSymbol))),Offset); 
            
    setShowTitleParameters(eval(Params));
            
    setShowSeries(PlotUp_Lo_BB,0);
            
    setShowSeries(PlotUp_Lo_BB,2);
            
    setShowSeries(PlotMidBB,1);
            
    bInit true;
        }
        
    valUp=RoundAll(xUpBB.getValue(0));
        
    valLo=RoundAll(xLoBB.getValue(0));
        if(
    valUp==null || valLo==null) return;
        
    pUp=(valUp+"").length;
        
    pLo=(valLo+"").length;
        
    xOff parseInt(Offset/2)-Math.max(parseInt(pUp/2),parseInt(pLo/2))-1;
        if(
    getCurrentBarIndex()==0){
            
    drawLineRelative( -3valUpOffset+3valUpPS_SOLID4Color.black"BBu"+105 ); 
            
    drawLineRelative( -3valLoOffset+3valLoPS_SOLID4Color.black"BBl"+105 ); 
            
    drawLineRelative( -2valLo+minTick, -2valUp-minTickPS_SOLID9BgColor"BBl"+106 ); 
            
    drawLineRelative( -1valLo+minTick, -1valUp-minTickPS_SOLID9BgColor"BBl"+107 ); 
            
    drawLineRelative0valLo+minTick0valUp-minTickPS_SOLID9BgColor"BBl"+108 ); 
            
    drawLineRelative1valLo+minTick1valUp-minTickPS_SOLID9BgColor"BBl"+109 ); 
            
    drawLineRelative2valLo+minTick2valUp-minTickPS_SOLID9BgColor"BBl"+110 ); 
            
    drawLineRelative3valLo+minTick3valUp-minTickPS_SOLID9BgColor"BBl"+111 ); 
            
    drawLineRelative4valLo+minTick4valUp-minTickPS_SOLID9BgColor"BBl"+112 ); 
            
    drawLineRelative5valLo+minTick5valUp-minTickPS_SOLID9BgColor"BBl"+113 ); 
            
    drawLineRelative6valLo+minTick6valUp-minTickPS_SOLID9BgColor"BBl"+114 ); 
            
    drawLineRelative7valLo+minTick7valUp-minTickPS_SOLID9BgColor"BBl"+115 ); 
            
    drawLineRelative8valLo+minTick8valUp-minTickPS_SOLID9BgColor"BBl"+116 ); 
            
    drawLineRelative9valLo+minTick9valUp-minTickPS_SOLID9BgColor"BBl"+117 ); 
            
    drawLineRelative10valLo+minTick10valUp-minTickPS_SOLID9BgColor"BBl"+118 ); 
            
    drawLineRelative11valLo+minTick11valUp-minTickPS_SOLID9BgColor"BBl"+119 ); 
            
    drawLineRelative12valLo+minTick12valUp-minTickPS_SOLID9BgColor"BBl"+120 ); 
            
    drawLineRelative13valLo+minTick13valUp-minTickPS_SOLID5BgColor"BBl"+121 ); 
            
    drawTextRelative(xOffvalUpvalUp+""Color.yellowColor.blackText.ONTOP Text.VCENTER"Courier New"10"PUp"+10);
            
    drawTextRelative(xOffvalLovalLo+""Color.yellowColor.blackText.ONTOP Text.VCENTER"Courier New"10,"PLo"+10 );
        }


        return new Array (
    getSeries(xUpBB),getSeries(xMidBB),getSeries(xLoBB));
    }
    function 
    fnPaddingZeros(nInterger,szPaddingPos){
        var 
    x,nDecLength;
        if((
    getMinTick()+"").indexOf(".")==-1nDecLength 0;
        else{
            
    = (getMinTick() + "").split("."); 
            
    nDecLength x[1].length;
        }
        if((
    nInterger+"").indexOf(".")==-1){
            
    nPaddingLength nDecLength//if you want 0 for each missing decimal place
        
    }else{
            
    nPaddingLength nDecLength - ((nInterger+"").length - ((nInterger+"").indexOf(".")+1));
        }
        
    //get the length of "nInterger"
        
    var xInt Math.abs(nInterger);
        if((
    xInt+"").indexOf(".") == -1){
            if(
    nDecLength!=0xInt xInt+".";
        } else 
    xInt xInt +"";
        var 
    iLen xInt.length;
        
    iLen iLen nPaddingLength;
        
    //convert integer to string
        
    var sign "";
        var 
    str xInt;
        if(
    nInterger 0){
            
    sign "-";
            
    xInt = (nInterger *= -1).toString();
        }

        while(
    xInt.length iLen){
                if(
    szPaddingPos == "start") { xInt '0' xInt; }
                else if(
    szPaddingPos == "end") { xInt xInt '0'; }
        }
        return 
    sign xInt;
    }
    function 
    RoundAll(Val){
        var 
    tick getMinTick();
        function 
    rnd(valueN) {//N = round to N # of digits
            
    var n;
            var 
    mult=1;
            for(
    n=0;n<N;n++) mult*=10;
            
    value*=mult;
            return 
    Math.roundvalue,N)/mult;
        }  


        
    //////////////////////////////////Frac() goes with RoundToIncrement()//////////////
        //== Frac functions returns the fractional portion of a real number
        
    function FraciVal ) {
            var 
    Math.flooriVal );
            return( 
    iVal );
        }  
        
    //== Round the price to the nearest increment value
        
    function RoundToIncrementiValiInc ) {
            var 
    iInt Math.flooriVal );
            var 
    iFrac FraciVal );
            var 
    iBase Math.roundiFrac iInc );

            return( 
    iInt + (iBase iInc) );
        }
        
    //////////////////////////////////Frac() goes with RoundToIncrement()//////////////
        
    if(tick == .25){
            var 
    RoundToIncrement(Val,tick)+"";
            var 
    Temp y.indexOf("."); 
            if(
    Temp == -1Temp 0;
            else 
    Temp =Temp -1;
            return 
    1*(fnPaddingZeros(y,"end"));
        }else{
            return 
    1*(fnPaddingZeros(rnd(Val,((tick+"").length-2)),"end"));
        }

    Wayne

    Comment


    • #3
      Thank you so much Wayne, that would do the job

      Thank you again

      Aquilhm

      Comment


      • #4
        yw

        Wayne

        Comment

        Working...
        X