Announcement

Collapse
No announcement yet.

reset efs colorbars at midnight...

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

  • reset efs colorbars at midnight...

    Hello:

    I was hoping someone could tell me how to modify this efs so that the price bars are colored yellow at midnight, and stay yellow until the next signal (the user defined start time) is generated. Thanks...

    Steve



    /************************************************** ******************
    Title: Bracket Script for eSignal 7.x
    By: Chris D. Kryza (Divergence Software, Inc.)
    Email: [email protected], [email protected]
    Web: http://www.sr-analyst.com
    Incept: 06/29/2007
    Version: 1.2.0

    ================================================== ===================
    Fix History:

    08/17/2007 - Added targets, price slope comparison with 1.0 rounding
    1.2.0 option.

    08/13/2007 - Added volume option.
    1.1.0

    06/30/2007 - Initial Release
    1.0.0

    ================================================== ===================
    Project Description:


    Dislaimer: For educational purposes only! Obviously, no guarantees
    whatsoever and use at your own risk.

    ************************************************** ********************/


    //External Variables
    var grID = 0;
    var nTime = null;
    var sTime = null;
    var nStartTime = null;
    var nInitialPrice = 0;
    var nVol = 0;
    var nCumVol = 0;
    var nBarCounter = 0;
    var nLevel1 = 0;
    var nLevel2 = null;
    var nLTarget = null;
    var nSTarget = null;
    var nStudy1 = null;
    var aFPArray = new Array();
    var bInitialized = false;
    var bUseTime = false;
    var bReset = false;


    //== PreMain function required by eSignal to set things up
    function preMain() {
    var x;

    setPriceStudy(true);
    setStudyTitle("SPECIFIC TIME ENTRY BRACKET");
    setCursorLabelName(" LONG TARGET =", 0);
    setCursorLabelName("ENTER LONG @", 1);
    setCursorLabelName("ENTER SHORT @", 2 );
    setCursorLabelName(" SHORT TARGET =", 3);
    setDefaultBarFgColor( Color.blue, 0 );
    setDefaultBarFgColor( Color.blue, 1 );
    setDefaultBarFgColor( Color.red, 2 );
    setDefaultBarFgColor( Color.red, 3 );
    setPlotType( PLOTTYPE_DOT, 0 );
    setPlotType( PLOTTYPE_FLATLINES, 1 );
    setPlotType( PLOTTYPE_FLATLINES, 2 );
    setPlotType( PLOTTYPE_DOT, 3 );

    setShowTitleParameters( false );

    setColorPriceBars( true );
    setDefaultPriceBarColor( Color.black );

    //unrem this if you don't want the labels in cursor window
    //setShowCursorLabel(false);

    //unrem this if you don't want the study to update on every tick
    //setComputeOnClose();
    grID = 0;

    //initialize formula parameters
    x=0;
    aFPArray[x] = new FunctionParameter( "fStart", FunctionParameter.STRING);
    with( aFPArray[x] ) {
    setName( "Start Time" );
    setDefault( "02:00" );
    }
    x++;
    aFPArray[x] = new FunctionParameter( "fStartV", FunctionParameter.NUMBER);
    with( aFPArray[x] ) {
    setName( "Start Volume" );
    setLowerLimit( 0 );
    setDefault( 7500 );
    }
    x++;
    aFPArray[x] = new FunctionParameter( "fStartType", FunctionParameter.STRING);
    with( aFPArray[x] ) {
    setName( "Time or Volume" );
    addOption( "Use Start Time" );
    addOption( "Use Start Volume" );
    setDefault( "Use Start Time" );
    }
    x++;
    aFPArray[x] = new FunctionParameter( "fTarget", FunctionParameter.NUMBER);
    with( aFPArray[x] ) {
    setName( "Target (Points)" );
    setDefault( .01 );
    }
    x++
    aFPArray[x] = new FunctionParameter( "fType", FunctionParameter.STRING);
    with( aFPArray[x] ) {
    setName( "Rounding" );
    addOption( "Nearest Whole" );
    addOption( "EXACT" );
    setDefault( "EXACT" );
    }
    x++
    aFPArray[x] = new FunctionParameter( "fUpColor1", FunctionParameter.COLOR);
    with( aFPArray[x] ) {
    setName( "Upper Line Color" );
    setDefault( Color.black );
    }
    x++;
    aFPArray[x] = new FunctionParameter( "fUpThick1", FunctionParameter.NUMBER);
    with( aFPArray[x] ) {
    setName( "Upper Line Thickness" );
    setLowerLimit( 1 );
    setUpperLimit( 10 );
    setDefault( 3 );
    }
    x++;
    aFPArray[x] = new FunctionParameter( "fDnColor1", FunctionParameter.COLOR);
    with( aFPArray[x] ) {
    setName( "Lower Line Color" );
    setDefault( Color.black );
    }
    x++;
    aFPArray[x] = new FunctionParameter( "fDnThick1", FunctionParameter.NUMBER);
    with( aFPArray[x] ) {
    setName( "Lower Line Thickness" );
    setLowerLimit( 1 );
    setUpperLimit( 10 );
    setDefault( 3 );
    }
    x++;
    aFPArray[x] = new FunctionParameter( "fColor2", FunctionParameter.COLOR);
    with( aFPArray[x] ) {
    setName( "Up Bar Color" );
    setDefault( Color.blue );
    }
    x++;
    aFPArray[x] = new FunctionParameter( "fColor3", FunctionParameter.COLOR);
    with( aFPArray[x] ) {
    setName( "Dn Bar Color" );
    setDefault( Color.red );
    }


    }

    //== Main processing function
    function main( fStart, fStartV,
    fStartType, fTarget, fType,
    fUpColor1, fUpThick1,
    fDnColor1, fDnThick1,
    fColor2, fColor3 ) {
    var x;


    //script is initializing
    if ( getBarState() == BARSTATE_ALLBARS ) {
    return null;
    }

    if ( bInitialized == false ) {

    bUseTime = fStartType == "Use Start Time";

    nStartTime = TimeToMinutes( fStart );

    setDefaultBarFgColor( fUpColor1, 0 );
    setDefaultBarThickness( Math.round( fUpThick1 ), 0 );
    setDefaultBarStyle( PS_DASH, 0 );

    setDefaultBarFgColor( fUpColor1, 1 );
    setDefaultBarThickness( Math.round( fUpThick1 ), 1 );

    setDefaultBarFgColor( fDnColor1, 2 );
    setDefaultBarThickness( Math.round( fDnThick1 ), 2 );

    setDefaultBarFgColor( fDnColor1, 3 );
    setDefaultBarThickness( Math.round( fDnThick1 ), 3 );
    setDefaultBarStyle( PS_DASH, 3 );


    bInitialized = true;
    }

    //called on each new bar
    if ( getBarState() == BARSTATE_NEWBAR ) {

    nTime = getBarTime(0);

    nCumVol += nVol;

    if ( getDay(0) != getDay(-1) ) {
    nVol = 0;
    nCumVol = 0;
    nInitialPrice = open(0);
    bReset = true;
    }

    nBarCounter++;

    }

    if ( nLevel2 != null && nLevel1 != null ) {

    if ( close()>nLevel1 ) {
    setPriceBarColor( fColor2 );
    setDefaultPriceBarColor( fColor2 );
    }
    else if ( close()<nLevel2 ) {
    setPriceBarColor( fColor3 );
    setDefaultPriceBarColor( fColor3 );
    }
    else {
    setPriceBarColor( Color.black );
    setDefaultPriceBarColor( Color.black );
    }

    if ( fTarget > 0 ) {
    if ( nLTarget != null ) {
    if ( high(0)>=nLTarget ) {
    nLTarget = null;
    }
    }
    if ( nSTarget != null ) {
    if ( low(0)<=nSTarget ) {
    nSTarget = null;
    }
    }
    }
    }


    nVol = volume(0);

    if ( bReset==true && ( ( bUseTime==true && nTime>=nStartTime ) || ( bUseTime==false && (nVol+nCumVol)>=fStartV ) ) ) {
    nOpen = close(0);
    if ( fType=="Nearest Whole" ) {
    nLevel1 = Math.ceil( nOpen );
    if ( nLevel1==nOpen ) {
    nLevel1++;
    }
    nLevel2 = Math.floor( nOpen );
    if ( nLevel2==nOpen ) {
    nLevel2--;
    }
    if ( fTarget > 0 ) {
    nLTarget = nLevel1 + fTarget;
    nSTarget = nLevel2 - fTarget;
    }

    }
    else {

    if ( open(0)>=nInitialPrice ) {
    nLevel2 = nOpen;
    nLevel1 = nOpen + 0;
    }
    else {
    nLevel2 = nOpen -0;
    nLevel1 = nOpen;
    }

    nLTarget = nSTarget = null;
    if ( fTarget > 0 ) {
    nLTarget = nLevel1 + fTarget;
    nSTarget = nLevel2 - fTarget;
    }
    }
    sTime = iPad( getHour() ) + ":" + iPad( getMinute() );
    bReset = false;
    }

    if ( nLevel1 != null && nLevel2 != null ) {

    if ( isLastBarOnChart() ) {
    if ( bUseTime==true ) {
    nTmp = nLevel1;
    drawTextRelative( 2, nTmp, nTmp.toFixed(4) + " = ENTRY " , Color.black, null, Text.BOTTOM | Text.BOLD, null, 8, "TT-1" );
    nTmp = nLTarget;
    if ( nTmp != null )
    drawTextRelative( 2, nTmp, nTmp.toFixed(4) + " = " + fTarget + " POINT TARGET" , Color.black, null, Text.VCENTER | Text.BOLD, null, 8, "TF-1" );

    nTmp = nLevel2;
    drawTextRelative( 2, nTmp, nTmp.toFixed(4) + " = ENTRY " , Color.black, null, Text.VCENTER | Text.BOLD, null, 14, "TT-2" );
    nTmp = nSTarget;
    if ( nTmp != null )
    drawTextRelative( 2, nTmp, nTmp.toFixed(4) + " = " + fTarget + " POINT TARGET" , Color.black, null, Text.VCENTER | Text.BOLD, null, 14, "TF-2" );

    }
    else {
    nTmp = nLevel1;
    drawTextRelative( 2, nTmp, nTmp.toFixed(4) + " = LONG BASELINE @ "+ sTime , Color.black, null, Text.BOTTOM | Text.BOLD, null, 14, "TT-1" );
    nTmp = nLTarget;
    if ( nTmp != null )
    drawTextRelative( 2, nTmp, nTmp.toFixed(4) + " = " + fTarget + " POINT TARGET" , Color.black, null, Text.VCENTER | Text.BOLD, null, 14, "TF-1" );

    nTmp = nLevel2;
    drawTextRelative( 2, nTmp, nTmp.toFixed(4) + " = SHORT BASELINE @ "+ sTime , Color.black, null, Text.TOP | Text.BOLD, null, 14, "TT-2" );
    nTmp = nSTarget;
    if ( nTmp != null )
    drawTextRelative( 2, nTmp, nTmp.toFixed(4) + " = " + fTarget + " POINT TARGET" , Color.black, null, Text.VCENTER | Text.BOLD, null, 14, "TF-2" );

    }

    }
    }


    return new Array( nLTarget, nLevel1, nLevel2, nSTarget );


    }


    /*************************************************
    SUPPORT FUNCTIONS
    **************************************************/

    //== Converts string time representation to minutes
    function TimeToMinutes( sStr ) {
    var i;
    var nTmp;

    if ( sStr == "0" ) return( -1 );
    i = sStr.split( ":" );
    nTmp = 0 + (i[0] * 60) + (i[1]*1);
    return ( nTmp );
    }


    //get the current bar time (as total minutes)
    function getBarTime( nOffset ) {
    var nTmp = 0;
    nTmp = (getHour(-nOffset)*60) + getMinute(-nOffset);
    return( nTmp );
    }

    function getMid( _src ) {
    return( efsInternal( "_getMid", _src ) );
    }

    function _getMid(_src ) {
    return( ( high(0) + low(0) )/2 );
    }

    //== gID function assigns unique identifier to graphic/text routines
    function gID() {
    grID ++;
    return( grID );
    }

    //==rnd will round to N digits.
    function rnd(value, N) {
    var n;
    var mult=1;
    for(n=0;n<N;n++) mult*=10;
    value*=mult;
    return Math.round( value,N)/mult;
    }

    //== Frac functions returns the fractional portion of a real number
    function Frac( iVal ) {
    var x = Math.floor( iVal );
    return( iVal - x );
    }

    function iPad( nVal ) {

    if ( nVal<10 ) return( "0"+nVal );
    return( ""+nVal );

    }

  • #2
    Re: reset efs colorbars at midnight...

    Steve
    One way to do that would be to insert the following lines of code just above main's return statement
    PHP Code:
    var xTime fStart.split(":");
    if(
    xTime[0].charAt(0)==0xTime[0]= xTime[0].charAt(1);
    if((
    hour(0)*100)+minute(0)>=&& (hour(0)*100)+minute(0)<(xTime[0]+xTime[1])) setPriceBarColor(Color.yellow); 
    In the logic I first split [at the :] the string that represents the user defined start time. This creates an array of two elements.
    Then I create a condition to check if the first character of the first element of the array is a 0 in which case I assign to that element only the second character.
    Lastly I create a condition that checks if the time is greater than 0 (ie midnight) and less than the concatenated elements of the array and paint the bars accordingly.
    In the screenshot enclosed below you can see the modified script with a start time of 06:30
    Alex



    Originally posted by jones24621
    Hello:

    I was hoping someone could tell me how to modify this efs so that the price bars are colored yellow at midnight, and stay yellow until the next signal (the user defined start time) is generated. Thanks...

    Steve



    /************************************************** ******************
    Title: Bracket Script for eSignal 7.x
    By: Chris D. Kryza (Divergence Software, Inc.)
    Email: [email protected], [email protected]
    Web: http://www.sr-analyst.com
    Incept: 06/29/2007
    Version: 1.2.0

    ================================================== ===================
    Fix History:

    08/17/2007 - Added targets, price slope comparison with 1.0 rounding
    1.2.0 option.

    08/13/2007 - Added volume option.
    1.1.0

    06/30/2007 - Initial Release
    1.0.0

    ================================================== ===================
    Project Description:


    Dislaimer: For educational purposes only! Obviously, no guarantees
    whatsoever and use at your own risk.

    ************************************************** ********************/


    //External Variables
    var grID = 0;
    var nTime = null;
    var sTime = null;
    var nStartTime = null;
    var nInitialPrice = 0;
    var nVol = 0;
    var nCumVol = 0;
    var nBarCounter = 0;
    var nLevel1 = 0;
    var nLevel2 = null;
    var nLTarget = null;
    var nSTarget = null;
    var nStudy1 = null;
    var aFPArray = new Array();
    var bInitialized = false;
    var bUseTime = false;
    var bReset = false;


    //== PreMain function required by eSignal to set things up
    function preMain() {
    var x;

    setPriceStudy(true);
    setStudyTitle("SPECIFIC TIME ENTRY BRACKET");
    setCursorLabelName(" LONG TARGET =", 0);
    setCursorLabelName("ENTER LONG @", 1);
    setCursorLabelName("ENTER SHORT @", 2 );
    setCursorLabelName(" SHORT TARGET =", 3);
    setDefaultBarFgColor( Color.blue, 0 );
    setDefaultBarFgColor( Color.blue, 1 );
    setDefaultBarFgColor( Color.red, 2 );
    setDefaultBarFgColor( Color.red, 3 );
    setPlotType( PLOTTYPE_DOT, 0 );
    setPlotType( PLOTTYPE_FLATLINES, 1 );
    setPlotType( PLOTTYPE_FLATLINES, 2 );
    setPlotType( PLOTTYPE_DOT, 3 );

    setShowTitleParameters( false );

    setColorPriceBars( true );
    setDefaultPriceBarColor( Color.black );

    //unrem this if you don't want the labels in cursor window
    //setShowCursorLabel(false);

    //unrem this if you don't want the study to update on every tick
    //setComputeOnClose();
    grID = 0;

    //initialize formula parameters
    x=0;
    aFPArray[x] = new FunctionParameter( "fStart", FunctionParameter.STRING);
    with( aFPArray[x] ) {
    setName( "Start Time" );
    setDefault( "02:00" );
    }
    x++;
    aFPArray[x] = new FunctionParameter( "fStartV", FunctionParameter.NUMBER);
    with( aFPArray[x] ) {
    setName( "Start Volume" );
    setLowerLimit( 0 );
    setDefault( 7500 );
    }
    x++;
    aFPArray[x] = new FunctionParameter( "fStartType", FunctionParameter.STRING);
    with( aFPArray[x] ) {
    setName( "Time or Volume" );
    addOption( "Use Start Time" );
    addOption( "Use Start Volume" );
    setDefault( "Use Start Time" );
    }
    x++;
    aFPArray[x] = new FunctionParameter( "fTarget", FunctionParameter.NUMBER);
    with( aFPArray[x] ) {
    setName( "Target (Points)" );
    setDefault( .01 );
    }
    x++
    aFPArray[x] = new FunctionParameter( "fType", FunctionParameter.STRING);
    with( aFPArray[x] ) {
    setName( "Rounding" );
    addOption( "Nearest Whole" );
    addOption( "EXACT" );
    setDefault( "EXACT" );
    }
    x++
    aFPArray[x] = new FunctionParameter( "fUpColor1", FunctionParameter.COLOR);
    with( aFPArray[x] ) {
    setName( "Upper Line Color" );
    setDefault( Color.black );
    }
    x++;
    aFPArray[x] = new FunctionParameter( "fUpThick1", FunctionParameter.NUMBER);
    with( aFPArray[x] ) {
    setName( "Upper Line Thickness" );
    setLowerLimit( 1 );
    setUpperLimit( 10 );
    setDefault( 3 );
    }
    x++;
    aFPArray[x] = new FunctionParameter( "fDnColor1", FunctionParameter.COLOR);
    with( aFPArray[x] ) {
    setName( "Lower Line Color" );
    setDefault( Color.black );
    }
    x++;
    aFPArray[x] = new FunctionParameter( "fDnThick1", FunctionParameter.NUMBER);
    with( aFPArray[x] ) {
    setName( "Lower Line Thickness" );
    setLowerLimit( 1 );
    setUpperLimit( 10 );
    setDefault( 3 );
    }
    x++;
    aFPArray[x] = new FunctionParameter( "fColor2", FunctionParameter.COLOR);
    with( aFPArray[x] ) {
    setName( "Up Bar Color" );
    setDefault( Color.blue );
    }
    x++;
    aFPArray[x] = new FunctionParameter( "fColor3", FunctionParameter.COLOR);
    with( aFPArray[x] ) {
    setName( "Dn Bar Color" );
    setDefault( Color.red );
    }


    }

    //== Main processing function
    function main( fStart, fStartV,
    fStartType, fTarget, fType,
    fUpColor1, fUpThick1,
    fDnColor1, fDnThick1,
    fColor2, fColor3 ) {
    var x;


    //script is initializing
    if ( getBarState() == BARSTATE_ALLBARS ) {
    return null;
    }

    if ( bInitialized == false ) {

    bUseTime = fStartType == "Use Start Time";

    nStartTime = TimeToMinutes( fStart );

    setDefaultBarFgColor( fUpColor1, 0 );
    setDefaultBarThickness( Math.round( fUpThick1 ), 0 );
    setDefaultBarStyle( PS_DASH, 0 );

    setDefaultBarFgColor( fUpColor1, 1 );
    setDefaultBarThickness( Math.round( fUpThick1 ), 1 );

    setDefaultBarFgColor( fDnColor1, 2 );
    setDefaultBarThickness( Math.round( fDnThick1 ), 2 );

    setDefaultBarFgColor( fDnColor1, 3 );
    setDefaultBarThickness( Math.round( fDnThick1 ), 3 );
    setDefaultBarStyle( PS_DASH, 3 );


    bInitialized = true;
    }

    //called on each new bar
    if ( getBarState() == BARSTATE_NEWBAR ) {

    nTime = getBarTime(0);

    nCumVol += nVol;

    if ( getDay(0) != getDay(-1) ) {
    nVol = 0;
    nCumVol = 0;
    nInitialPrice = open(0);
    bReset = true;
    }

    nBarCounter++;

    }

    if ( nLevel2 != null && nLevel1 != null ) {

    if ( close()>nLevel1 ) {
    setPriceBarColor( fColor2 );
    setDefaultPriceBarColor( fColor2 );
    }
    else if ( close()<nLevel2 ) {
    setPriceBarColor( fColor3 );
    setDefaultPriceBarColor( fColor3 );
    }
    else {
    setPriceBarColor( Color.black );
    setDefaultPriceBarColor( Color.black );
    }

    if ( fTarget > 0 ) {
    if ( nLTarget != null ) {
    if ( high(0)>=nLTarget ) {
    nLTarget = null;
    }
    }
    if ( nSTarget != null ) {
    if ( low(0)<=nSTarget ) {
    nSTarget = null;
    }
    }
    }
    }


    nVol = volume(0);

    if ( bReset==true && ( ( bUseTime==true && nTime>=nStartTime ) || ( bUseTime==false && (nVol+nCumVol)>=fStartV ) ) ) {
    nOpen = close(0);
    if ( fType=="Nearest Whole" ) {
    nLevel1 = Math.ceil( nOpen );
    if ( nLevel1==nOpen ) {
    nLevel1++;
    }
    nLevel2 = Math.floor( nOpen );
    if ( nLevel2==nOpen ) {
    nLevel2--;
    }
    if ( fTarget > 0 ) {
    nLTarget = nLevel1 + fTarget;
    nSTarget = nLevel2 - fTarget;
    }

    }
    else {

    if ( open(0)>=nInitialPrice ) {
    nLevel2 = nOpen;
    nLevel1 = nOpen + 0;
    }
    else {
    nLevel2 = nOpen -0;
    nLevel1 = nOpen;
    }

    nLTarget = nSTarget = null;
    if ( fTarget > 0 ) {
    nLTarget = nLevel1 + fTarget;
    nSTarget = nLevel2 - fTarget;
    }
    }
    sTime = iPad( getHour() ) + ":" + iPad( getMinute() );
    bReset = false;
    }

    if ( nLevel1 != null && nLevel2 != null ) {

    if ( isLastBarOnChart() ) {
    if ( bUseTime==true ) {
    nTmp = nLevel1;
    drawTextRelative( 2, nTmp, nTmp.toFixed(4) + " = ENTRY " , Color.black, null, Text.BOTTOM | Text.BOLD, null, 8, "TT-1" );
    nTmp = nLTarget;
    if ( nTmp != null )
    drawTextRelative( 2, nTmp, nTmp.toFixed(4) + " = " + fTarget + " POINT TARGET" , Color.black, null, Text.VCENTER | Text.BOLD, null, 8, "TF-1" );

    nTmp = nLevel2;
    drawTextRelative( 2, nTmp, nTmp.toFixed(4) + " = ENTRY " , Color.black, null, Text.VCENTER | Text.BOLD, null, 14, "TT-2" );
    nTmp = nSTarget;
    if ( nTmp != null )
    drawTextRelative( 2, nTmp, nTmp.toFixed(4) + " = " + fTarget + " POINT TARGET" , Color.black, null, Text.VCENTER | Text.BOLD, null, 14, "TF-2" );

    }
    else {
    nTmp = nLevel1;
    drawTextRelative( 2, nTmp, nTmp.toFixed(4) + " = LONG BASELINE @ "+ sTime , Color.black, null, Text.BOTTOM | Text.BOLD, null, 14, "TT-1" );
    nTmp = nLTarget;
    if ( nTmp != null )
    drawTextRelative( 2, nTmp, nTmp.toFixed(4) + " = " + fTarget + " POINT TARGET" , Color.black, null, Text.VCENTER | Text.BOLD, null, 14, "TF-1" );

    nTmp = nLevel2;
    drawTextRelative( 2, nTmp, nTmp.toFixed(4) + " = SHORT BASELINE @ "+ sTime , Color.black, null, Text.TOP | Text.BOLD, null, 14, "TT-2" );
    nTmp = nSTarget;
    if ( nTmp != null )
    drawTextRelative( 2, nTmp, nTmp.toFixed(4) + " = " + fTarget + " POINT TARGET" , Color.black, null, Text.VCENTER | Text.BOLD, null, 14, "TF-2" );

    }

    }
    }


    return new Array( nLTarget, nLevel1, nLevel2, nSTarget );


    }


    /*************************************************
    SUPPORT FUNCTIONS
    **************************************************/

    //== Converts string time representation to minutes
    function TimeToMinutes( sStr ) {
    var i;
    var nTmp;

    if ( sStr == "0" ) return( -1 );
    i = sStr.split( ":" );
    nTmp = 0 + (i[0] * 60) + (i[1]*1);
    return ( nTmp );
    }


    //get the current bar time (as total minutes)
    function getBarTime( nOffset ) {
    var nTmp = 0;
    nTmp = (getHour(-nOffset)*60) + getMinute(-nOffset);
    return( nTmp );
    }

    function getMid( _src ) {
    return( efsInternal( "_getMid", _src ) );
    }

    function _getMid(_src ) {
    return( ( high(0) + low(0) )/2 );
    }

    //== gID function assigns unique identifier to graphic/text routines
    function gID() {
    grID ++;
    return( grID );
    }

    //==rnd will round to N digits.
    function rnd(value, N) {
    var n;
    var mult=1;
    for(n=0;n<N;n++) mult*=10;
    value*=mult;
    return Math.round( value,N)/mult;
    }

    //== Frac functions returns the fractional portion of a real number
    function Frac( iVal ) {
    var x = Math.floor( iVal );
    return( iVal - x );
    }

    function iPad( nVal ) {

    if ( nVal<10 ) return( "0"+nVal );
    return( ""+nVal );

    }

    Comment


    • #3
      Alexis,

      Great example of simple manipulation of time. It will go into my sample archives.

      Thanks

      Wayne

      Comment


      • #4
        reset efs colorbars at midnight...

        Alexis:

        Thanks so much for your quick reply. Your code worked perfectly...

        Steve

        Comment


        • #5
          Steve
          You are most welcome
          Alex

          Comment

          Working...
          X