Announcement

Collapse
No announcement yet.

NEWBAR efsInternal problem

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

  • NEWBAR efsInternal problem

    Hi
    -------------------------- ENDED HISTORIC BARS -------------------------------------

    Caller(): a = -305 b = -305 c = 0
    Caller(): ----------------------------- NEWBAR Returned -----------------------------------------------
    Test(): a = -305 b = -306 c = 1 Vol = 98
    Caller(): a = -305 b = -306 c = 1
    Test(): a = -305 b = -307 c = 1 Vol = 100
    Test(): a = -305 b = -308 c = 1 Vol = 100
    Caller(): a = -305 b = -308 c = 1
    Test(): a = -305 b = -309 c = 1 Vol = 100
    Caller(): a = -305 b = -309 c = 1
    Test(): a = -305 b = -310 c = 1 Vol = 198
    Test(): a = -305 b = -311 c = 1 Vol = 198
    Caller(): a = -305 b = -311 c = 1
    Test(): a = -305 b = -312 c = 1 Vol = 198
    Caller(): a = -305 b = -312 c = 1
    Test(): a = -305 b = -313 c = 1 Vol = 199
    Test(): a = -305 b = -314 c = 1 Vol = 199
    Caller(): a = -305 b = -314 c = 1
    Test(): a = -305 b = -315 c = 1 Vol = 199
    Caller(): a = -305 b = -315 c = 1
    Test(): a = -305 b = -316 c = 1 Vol = 200
    Test(): a = -305 b = -317 c = 1 Vol = 200
    Caller(): a = -305 b = -317 c = 1
    Test(): !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! NEWBAR DETECTED !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    Test(): a = -306 b = -318 c = 0 Vol = 50
    Test(): a = -306 b = -319 c = 1 Vol = 50
    Caller(): a = -306 b = -319 c = 1
    Test(): a = -306 b = -320 c = 1 Vol = 50
    A function (test()) is called using efsInternal and passed a series that is different to the chart (say ES,200V for the passed series vs ES,1 for the chart). The Test() routine returns an array of three (series of) numbers, the first is the barcount (as a negative), the second an internal counter (also negative) and the third is the getBarState() value (0 = BARSTATE_NEWBAR, 1 BARSTATE_CURRENTBAR).

    While historic bars are processed I don't get a problem, but when the current bar ticks arrive there seems to be missing data (except for the very first one).

    The output generally shows a line printed in the Test() code, followed by a line in the Caller() (ie main()), this is what I expect (as we have got to the current bar).

    For starters note that the Test() routine is often apparently frequently called twice between Caller() lines (see unchanged volume print suggesting simple duplication). For ticks in the current bar I would expect the efsInternal()ed Test() code to be called once per tick, like main() is? This would appear to indicate an erroneous call to Test()?

    But more awkward is what happens when the 200V series gets a NEWBAR. See that it is detected in the Test() code (see "c = 0" value and the "...!!! NEWBAR DETECTED!!!.." print).

    But in the Caller() code we simply don't get to process the NEWBAR for the 200V series - see there is no Caller line with c = 0. As my Test() routine is actually meant to do processing and return meaningful data only when a NEWBAR does occur this is a problem.

    Here is the code, I can't see anything stupid, so I think it is a bug?

    10.1.1291.910 (7/14/2008)


    PHP Code:
    function preMain() {
        
    setStudyTitle("efsInternal DEBUG missing return for NEWBAR in different series");
     }

    var 
    mbOnceInit false;
    var 
    mSeries2 null;
    var 
    msInt "200V";  // run on a chart that is not 200V
    var ms null;
    var 
    mbLast false;
    function 
    main (){
        
        if (!
    mbOnceInit) {
            
    mSeries2 sym(getSymbol()+"," msInt);
            
    ms efsInternal("Test"mSeries2);
            
    mbOnceInit true;
        }
        if (!
    mbLast && isLastBarOnChart()) {
            
    mbLast true;
            
    debugPrint("\n -------------------------- ENDED HISTORIC BARS -------------------------------------\n\n");
        }
        
    debugPrint("Caller(): a = " getSeries(ms,0).getValue(0) + " b = " getSeries(ms,1).getValue(0) + " c = " getSeries(ms,2).getValue(0) + "\n");

        if (
    getSeries(ms,2).getValue(0) == BARSTATE_NEWBAR) {
            
    debugPrint("Caller(): ----------------------------- NEWBAR Returned -----------------------------------------------" "\n");
        }
        return 
    getSeries(ms,0).getValue(0),getSeries(ms,2).getValue(0);    
    }

    var 
    mnNoTest 0;
    var 
    mnDummy 0;

    function 
    TestserSource) { // executes in serSource (ie getBarState(), volume()
        
    var nBS getBarState(); 
        
        if ( 
    nBS == BARSTATE_NEWBAR ) {
            
    // note that for historical bars these don't occur synchronoulsy with the caller (the series is built eparately)
            
    debugPrint("Test(): !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! NEWBAR DETECTED !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" "\n");
        }
      
        
    mnDummy --;
        var 
    = -getCurrentBarCount() ; 
        var 
    b  mnDummy ;
        var 
    nBS// should see splinkling of BARSTATE_NEWBAR in many BARSTATE_CURRENTBAR
        
    debugPrint("Test():   "   "a = " " b = " b  " c = " " Vol = " volume() + "\n");
        return new Array(
    a,b,c);


  • #2
    can I ask what you are trying to accomplish with this? Are you trying to identify when a new bar forms on the 200v chart?
    Brad Matheny
    eSignal Solution Provider since 2000

    Comment


    • #3
      Is it related to the bug reported in this thread?

      Comment


      • #4
        clearpicks - I don't think it is related. My issue is that when I access the efsInternal()ed function from main() I don't see the result it returns for the NEWBAR event in the series (same symbol, different interval) that the efsInternal()ed function is running. There is no synchronisation issue (one series is tick-based volume).

        Brad - The identification of the NEWBAR in the "auxillary" series is not the problem (either in the efsInternal()ed function or in the caller).
        I simply want the efsInternal()ed function to do something (and return a value I can use) only when there is a NEWBAR in the series it is processing. I can't recode it to handle the "auxiliary" series directly as I use a function in a library that does not take a series parameter.

        Comment


        • #5
          Test(): a = -305 b = -316 c = 1 Vol = 200
          Test(): a = -305 b = -317 c = 1 Vol = 200

          Look at these two lines, do they mean Test() was called twice with the volume of 200V not being changed but mnDummy was decreased twice? If so, it means Test() was called twice by the same trade. Also as far as I know, EFS would compress trades if trades are executed at the same last price with same bid/ask. Maybe a newbar event would force main() is called. ( I am still not clear about such kind of details ). Anyway, if that is the case, due to such kind of compression, main() in different timeframes would see different tick counts (# of trades).

          You may try to print out time/last/bid/ask in both caller and tester to verify whether what I said is true or not.

          Comment


          • #6
            Look at these two lines, do they mean Test() was called twice with the volume of 200V not being changed but mnDummy was decreased twice? If so, it means Test() was called twice by the same trade.
            Clearpicks - Does that mean you agree with what I said? If I wasn't clear it is what I meant.

            I have at least found a way around the missing NEWBAR return in the caller (just use the NEWBAR counter return value and the caller checks for when it changes, together with freezing the real return values so they are available when needed).
            Dave

            Comment


            • #7
              I agree with you. Look at the debug output:

              Test(): a = -305 b = -316 c = 1 Vol = 200
              Test(): a = -305 b = -317 c = 1 Vol = 200

              If the "Vol = 200" is the volume of the current 200V bar, with the same values of "a" but different values of "b", Vol should be different. However in your debug result, Vol = 200 appeared twice, so it seems to me something is wrong in EFS engine.

              - Clearpicks

              Originally posted by Dave180
              Clearpicks - Does that mean you agree with what I said? If I wasn't clear it is what I meant.

              I have at least found a way around the missing NEWBAR return in the caller (just use the NEWBAR counter return value and the caller checks for when it changes, together with freezing the real return values so they are available when needed).
              Dave

              Comment


              • #8
                Dave180
                Based on what I am seeing it would appear that both the issues you describe [assuming I understood you correctly] have already been addressed and corrected in the version that has just been released. Enclosed below is an excerpt of the debug output of your formula with the external interval set to 50V
                Alex

                Caller(): ----------------------------- NEWBAR Returned -----------------------------------------------
                Caller(): a = -300 b = -300 c = 0
                Caller(): ----------------------------- NEWBAR Returned -----------------------------------------------

                -------------------------- ENDED HISTORIC BARS -------------------------------------

                Caller(): a = -302 b = -302 c = 0
                Caller(): ----------------------------- NEWBAR Returned -----------------------------------------------
                Test(): !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! NEWBAR DETECTED !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
                Test(): a = -303 b = -303 c = 0 Vol = 1
                Caller(): a = -303 b = -303 c = 0
                Caller(): ----------------------------- NEWBAR Returned -----------------------------------------------
                Test(): a = -303 b = -304 c = 1 Vol = 4
                Caller(): a = -303 b = -304 c = 1
                Test(): a = -303 b = -305 c = 1 Vol = 5
                Caller(): a = -303 b = -305 c = 1
                Test(): a = -303 b = -306 c = 1 Vol = 6
                Caller(): a = -303 b = -306 c = 1
                Test(): a = -303 b = -307 c = 1 Vol = 7
                Caller(): a = -303 b = -307 c = 1
                Test(): a = -303 b = -308 c = 1 Vol = 8
                Caller(): a = -303 b = -308 c = 1
                Test(): a = -303 b = -309 c = 1 Vol = 9
                Caller(): a = -303 b = -309 c = 1
                Test(): a = -303 b = -310 c = 1 Vol = 10
                Caller(): a = -303 b = -310 c = 1
                Test(): a = -303 b = -311 c = 1 Vol = 15
                Caller(): a = -303 b = -311 c = 1
                Test(): a = -303 b = -312 c = 1 Vol = 20
                Caller(): a = -303 b = -312 c = 1
                Test(): a = -303 b = -313 c = 1 Vol = 21
                Caller(): a = -303 b = -313 c = 1
                Test(): a = -303 b = -314 c = 1 Vol = 24
                Caller(): a = -303 b = -314 c = 1
                Test(): a = -303 b = -315 c = 1 Vol = 28
                Caller(): a = -303 b = -315 c = 1
                Test(): a = -303 b = -316 c = 1 Vol = 29
                Caller(): a = -303 b = -316 c = 1
                Test(): a = -303 b = -317 c = 1 Vol = 33
                Caller(): a = -303 b = -317 c = 1
                Test(): a = -303 b = -318 c = 1 Vol = 34
                Caller(): a = -303 b = -318 c = 1
                Test(): !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! NEWBAR DETECTED !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
                Test(): a = -304 b = -319 c = 0 Vol = 14
                Caller(): a = -304 b = -319 c = 0
                Caller(): ----------------------------- NEWBAR Returned -----------------------------------------------
                Test(): a = -304 b = -320 c = 1 Vol = 19
                Caller(): a = -304 b = -320 c = 1
                Test(): a = -304 b = -321 c = 1 Vol = 24
                Caller(): a = -304 b = -321 c = 1
                Test(): a = -304 b = -322 c = 1 Vol = 27
                Caller(): a = -304 b = -322 c = 1
                Test(): a = -304 b = -323 c = 1 Vol = 30
                Caller(): a = -304 b = -323 c = 1
                Test(): a = -304 b = -324 c = 1 Vol = 32
                Caller(): a = -304 b = -324 c = 1
                Test(): !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! NEWBAR DETECTED !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
                Test(): a = -305 b = -325 c = 0 Vol = 10
                Caller(): a = -305 b = -325 c = 0
                Caller(): ----------------------------- NEWBAR Returned -----------------------------------------------
                Test(): a = -305 b = -326 c = 1 Vol = 14
                Caller(): a = -305 b = -326 c = 1
                Test(): a = -305 b = -327 c = 1 Vol = 40
                Caller(): a = -305 b = -327 c = 1
                Test(): a = -305 b = -328 c = 1 Vol = 41
                Caller(): a = -305 b = -328 c = 1
                Test(): a = -305 b = -329 c = 1 Vol = 45
                Caller(): a = -305 b = -329 c = 1
                Test(): a = -305 b = -330 c = 1 Vol = 47
                Caller(): a = -305 b = -330 c = 1
                Test(): !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! NEWBAR DETECTED !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
                Test(): a = -306 b = -331 c = 0 Vol = 10
                Caller(): a = -306 b = -331 c = 0
                Caller(): ----------------------------- NEWBAR Returned -----------------------------------------------
                Test(): a = -306 b = -332 c = 1 Vol = 13
                Caller(): a = -306 b = -332 c = 1
                Test(): a = -306 b = -333 c = 1 Vol = 14
                Caller(): a = -306 b = -333 c = 1
                Test(): a = -306 b = -334 c = 1 Vol = 18
                Caller(): a = -306 b = -334 c = 1
                Test(): a = -306 b = -335 c = 1 Vol = 23
                Caller(): a = -306 b = -335 c = 1
                Test(): a = -306 b = -336 c = 1 Vol = 28
                Caller(): a = -306 b = -336 c = 1
                Test(): a = -306 b = -337 c = 1 Vol = 32
                Caller(): a = -306 b = -337 c = 1
                Test(): a = -306 b = -338 c = 1 Vol = 34
                Caller(): a = -306 b = -338 c = 1
                Test(): a = -306 b = -339 c = 1 Vol = 36
                Caller(): a = -306 b = -339 c = 1
                Test(): a = -306 b = -340 c = 1 Vol = 38
                Caller(): a = -306 b = -340 c = 1
                Test(): a = -306 b = -341 c = 1 Vol = 41
                Caller(): a = -306 b = -341 c = 1
                Test(): a = -306 b = -342 c = 1 Vol = 43
                Caller(): a = -306 b = -342 c = 1
                Test(): a = -306 b = -343 c = 1 Vol = 44
                Caller(): a = -306 b = -343 c = 1
                Test(): a = -306 b = -344 c = 1 Vol = 47
                Caller(): a = -306 b = -344 c = 1
                Test(): a = -306 b = -345 c = 1 Vol = 48
                Caller(): a = -306 b = -345 c = 1
                Test(): a = -306 b = -346 c = 1 Vol = 50
                Caller(): a = -306 b = -346 c = 1
                Test(): !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! NEWBAR DETECTED !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
                Test(): a = -307 b = -347 c = 0 Vol = 1
                Caller(): a = -307 b = -347 c = 0
                Caller(): ----------------------------- NEWBAR Returned -----------------------------------------------
                Test(): a = -307 b = -348 c = 1 Vol = 3
                Caller(): a = -307 b = -348 c = 1
                Test(): a = -307 b = -349 c = 1 Vol = 4
                Caller(): a = -307 b = -349 c = 1
                Test(): a = -307 b = -350 c = 1 Vol = 5
                Caller(): a = -307 b = -350 c = 1
                Test(): a = -307 b = -351 c = 1 Vol = 6
                Caller(): a = -307 b = -351 c = 1
                Test(): a = -307 b = -352 c = 1 Vol = 7
                Caller(): a = -307 b = -352 c = 1
                Test(): a = -307 b = -353 c = 1 Vol = 11
                Caller(): a = -307 b = -353 c = 1
                Test(): a = -307 b = -354 c = 1 Vol = 12
                Caller(): a = -307 b = -354 c = 1
                Test(): a = -307 b = -355 c = 1 Vol = 13
                Caller(): a = -307 b = -355 c = 1
                Test(): a = -307 b = -356 c = 1 Vol = 14
                Caller(): a = -307 b = -356 c = 1
                Test(): a = -307 b = -357 c = 1 Vol = 15
                Caller(): a = -307 b = -357 c = 1


                Originally posted by Dave180
                Hi


                A function (test()) is called using efsInternal and passed a series that is different to the chart (say ES,200V for the passed series vs ES,1 for the chart). The Test() routine returns an array of three (series of) numbers, the first is the barcount (as a negative), the second an internal counter (also negative) and the third is the getBarState() value (0 = BARSTATE_NEWBAR, 1 BARSTATE_CURRENTBAR).

                While historic bars are processed I don't get a problem, but when the current bar ticks arrive there seems to be missing data (except for the very first one).

                The output generally shows a line printed in the Test() code, followed by a line in the Caller() (ie main()), this is what I expect (as we have got to the current bar).

                For starters note that the Test() routine is often apparently frequently called twice between Caller() lines (see unchanged volume print suggesting simple duplication). For ticks in the current bar I would expect the efsInternal()ed Test() code to be called once per tick, like main() is? This would appear to indicate an erroneous call to Test()?

                But more awkward is what happens when the 200V series gets a NEWBAR. See that it is detected in the Test() code (see "c = 0" value and the "...!!! NEWBAR DETECTED!!!.." print).

                But in the Caller() code we simply don't get to process the NEWBAR for the 200V series - see there is no Caller line with c = 0. As my Test() routine is actually meant to do processing and return meaningful data only when a NEWBAR does occur this is a problem.

                Here is the code, I can't see anything stupid, so I think it is a bug?

                10.1.1291.910 (7/14/2008)


                PHP Code:
                function preMain() {
                 
                setStudyTitle("efsInternal DEBUG missing return for NEWBAR in different series");
                 }
                 
                var 
                mbOnceInit false;
                var 
                mSeries2 null;
                var 
                msInt "200V";  // run on a chart that is not 200V
                var ms null;
                var 
                mbLast false;
                function 
                main (){
                    
                 if (!
                mbOnceInit) {
                        
                mSeries2 sym(getSymbol()+"," msInt);
                        
                ms efsInternal("Test"mSeries2);
                        
                mbOnceInit true;
                 }
                    if (!
                mbLast && isLastBarOnChart()) {
                        
                mbLast true;
                        
                debugPrint("\n -------------------------- ENDED HISTORIC BARS -------------------------------------\n\n");
                    }
                    
                debugPrint("Caller(): a = " getSeries(ms,0).getValue(0) + " b = " getSeries(ms,1).getValue(0) + " c = " getSeries(ms,2).getValue(0) + "\n");
                 
                    if (
                getSeries(ms,2).getValue(0) == BARSTATE_NEWBAR) {
                        
                debugPrint("Caller(): ----------------------------- NEWBAR Returned -----------------------------------------------" "\n");
                    }
                 return 
                getSeries(ms,0).getValue(0),getSeries(ms,2).getValue(0); 
                }
                 
                var 
                mnNoTest 0;
                var 
                mnDummy 0;
                 
                function 
                TestserSource) { // executes in serSource (ie getBarState(), volume()
                    
                var nBS getBarState(); 
                 
                 if ( 
                nBS == BARSTATE_NEWBAR ) {
                        
                // note that for historical bars these don't occur synchronoulsy with the caller (the series is built eparately)
                        
                debugPrint("Test(): !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! NEWBAR DETECTED !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" "\n");
                    }
                  
                    
                mnDummy --;
                    var 
                = -getCurrentBarCount() ; 
                    var 
                b  mnDummy ;
                    var 
                nBS// should see splinkling of BARSTATE_NEWBAR in many BARSTATE_CURRENTBAR
                    
                debugPrint("Test():   "   "a = " " b = " b  " c = " " Vol = " volume() + "\n");
                    return new Array(
                a,b,c);

                Comment


                • #9
                  Thanks Alexis, pity eSignal can't publish a bug list rather than leave us to spend hours pondering over why thinks don't work, document, etc.

                  Comment


                  • #10
                    This is a rather interesting development. Is the limit still 6 symbols or external data series?

                    In my earlier code, I've had to do it the hard way. Given this new feature and the possibilities it presents, I may have to rethink some of my older projects.
                    Brad Matheny
                    eSignal Solution Provider since 2000

                    Comment


                    • #11
                      Brad
                      The limit is 7 external data series
                      Alex


                      Originally posted by Doji3333
                      This is a rather interesting development. Is the limit still 6 symbols or external data series?

                      In my earlier code, I've had to do it the hard way. Given this new feature and the possibilities it presents, I may have to rethink some of my older projects.

                      Comment

                      Working...
                      X