Announcement

Collapse
No announcement yet.

How to refresh efs when reloadEFS() and repaingChart() don't do it?

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

  • How to refresh efs when reloadEFS() and repaingChart() don't do it?

    Hi,

    I'm using "PivotConsole-v2.0.1.efs" by Chris D. Kryza found at:
    http://share.esignal.com/download.js...ole-v2.0.3.efs

    which must be reloaded at 9:30 EST via the mouse rightclick on the chart followed by clicking on the "Reload" then click on the efs study to refresh the data to the current day.

    I have tried to use both reloadEFS() and repaintChart() but neither updates the pivot point values. I must still manually do this just after 9:30. The code I tested that didn't work is:

    PHP Code:
    var xReloadTime 930;
    function 
    main(...
        if(
    bDayCounter == 0){
            if (
    getDay(0) == myDate.getDate()){
                
    vCorrection hour(0)*100 minute(0);
                
    bCurrentDay true;
                if(
    vCorrection >= xReloadTime){
                    
    repaintChart()
                    
    reloadEFS();//doesn't work because "setComputeOnClose()" is enabled
                    
    bDayCounter 1;
                }
            }
        }
    ...

    Is there some way to update the data via efs (preferably without a full chart reload since the bid/ask plot only plots real time and would be lost)?

    Thanks,

    Wayne
    Last edited by waynecd; 12-09-2010, 07:13 AM.

  • #2
    My solution:
    PHP Code:
    //efs Reload global variables
    var bCurrentDay false;
    var 
    FlagReload true;
    var 
    xReloadTime 930;

    function 
    main( ...){
        var 
    vCorrection;
        if ( 
    isDWM() ) return;
        var 
    myDate = new Date();
        if (
    getDay(0) == myDate.getDate()){
            if(!
    isNaN(getInterval())) vCorrection hour(0)*100 + (minute(0) + (getInterval()*1));
            else 
    vCorrection hour(0)*100 minute(0);
            
    bCurrentDay true;
            if(
    vCorrection xReloadTime && FlagReload){
                
    ResetVars();
                
    //repaintChart();//also works
                
    debugPrintln("Ran RELOAD" getSymbol() + ", " getInterval() +", at: " vCorrection ", " xReloadTime);//(hour(0)*100 + minute(0)));
                
    reloadEFS();
                
    FlagReload false;
            }
        }
    ....
    }
    function 
    ResetVars(){
        
    //use this to shift the button
        //display to the right if need be.
        
    nButtonOffset        0;

        
    //pivot label adjustment values
        //Defaults are 10 and 12.
        
    nLineEnd            10;
        
    nPLineEnd            35;
        
    nPLabelStart        37;
        
    nPStart                1;

        
    nDailyBG            Color.white;
        
    nWeeklyBG            Color.white;
        
    nMonthlyBG            Color.white;
        
    nVarBG                Color.white;
        
    nAtrBG                Color.white;

        
    nDailyLineType        null;
        
    nWeeklyLineType        null;
        
    nMonthlyLineType    null;
        
    nVarLineType        null;
        
    nATRLineType        null;
        
    nTextHeight            null;

        
    //ATR Calculation Variables - adjust as needed
        
    nATRColor            Color.grey;
        
    nATRFontSize        11;
        
    nATRFlags            Text.BOLD;

        
    //bar length to use for variable pivot calc
        
    nVariablePivot        0;
        
    nBarsSinceOpen        0;
        
    nMinTick            null;

        
    //Global Variables
        
    grID                0;
        
    afLabelArray        = new Array("showR3""showR2""showR1""showPivot""showMidPoint""showWaist""showS1""showS2"
                                            
    "showS3",  "showHigh""showClose""showLow""showR1S1MP""showPPS1MP""showPPR1MP""showS1S2MP",
                                            
    "showR1R2MP","showS2S3MP","showR2R3MP","showTodayOpen");
        
    aLabelArray         = new Array("R3","R2","R1","PP","MP","WA","S1","S2","S3","HI","CL","LO","R1/S1-MP","PP/S1-MP","PP/R1-MP","S1/S2-MP","R1/R2-MP","S2/S3-MP","R2/R3-MP","T-OP");
        
    aShowValues            = new Array(true,true,true,true,false,false,true,true,true,true,true,true,false,false,false,false,false,false,false,true);
        
    aLabels             = new Array("""V","M""W""D""G""P""(-)");
        
    aFPArray            = new Array();
        
    sDSymbol            null;
        
    sWSymbol            null;
        
    sMSymbol            null;
        
    sVSymbol            null;
        
    sTrigger            null;
        
    sForceRTH            null;
        
    nInterval            null;
        
    //nSymbol            = null;
        
    nDailyHi            null;
        
    nDailyLo            null;
        
    nDailyOpen            null;
        
    nCurVarTime            null;    

        
    nGapLevel            0;
        
    PPUseButtons        1;

        
    aDailyPivots        null;
        
    aWeeklyPivots        null;
        
    aMonthlyPivots        null;
        
    aVariablePivots        null;

        
    nTextFlags            null;
        
    nLabelFlags            null;

        
    bCollapsed            false;
        
    bIsDirty            false;
        
    bButtonPressed        false;
        
    bUseWoodie            false;
        
    bRound                false;
        
    xRnd                0;
        
    bInitialized        false;

        
    bFirst                true;
        
    bDoMonthly            false;
        
    bDoWeekly            false;
        
    bDoVariable            false;
        
    bDoDaily            true;
        
    bDailyDone            false;
        
    bWeeklyDone            false;
        
    bMonthlyDone        false;
        
    bVariableDone        false;
        
    bBaseRTH            true;
        
    blabelOnly            false;
        
    bProjectDaily        false;

        
    nATRPeriod            20;
        
    nATRType            1;
        
    nATR                0.0;
        
    nPosAtr                0.0;
        
    nNegAtr                0.0;

        
    //State Maint variables
        
    oSettings            = new Array();
        
    sUnique                "pvc";        //unique prefix to identify this script

        //efs Reload flag
        
    bCurrentDay false;

    Wayne

    Comment


    • #3
      FWIW I found a great explanation and workaround for issues with reloadefs() at:

      http://forum.esignalcentral.com/show...826#post129826

      where stevehare2003 states:

      The only downside is that global are not reset during a reloadEFS() invocation. This can be readily be compensated for by setting bInit to false just prior to executing reloadEFS().
      Wayne

      Comment

      Working...
      X