Announcement

Collapse
No announcement yet.

pre-Main() called more than once?

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

  • pre-Main() called more than once?

    Hello. In a backtesting script I've been developing, I found that use of the "highest" series causes pre-Main() to be called more than once.

    vHigh = highest(5,high(),inv("D"));

    It also causes main() to be called more than once with getBarState == BARSTATE_ALLBARS.

    Is this correct behaviour? And if so, is there a work-around?

    Thanks,

    - Ian

  • #2
    Ian

    Is this correct behaviour? And if so, is there a work-around?
    It is the correct behavior. The highest(), lowest() functions are wrappers calling the upperDonchian() and lowerDonchian() functions. The work-around is to use the upperDonchian() and lowerDonchian()[/i] functions directly
    That aside the syntax you are using for highest() is incorrect and should be
    vHigh = highest(5,high(inv("D")));
    For a complete series of examples on how to write the efs2 functions see this thread
    Alex

    Comment


    • #3
      pre-Main() called more than once?

      Thanks! That resolved the issue.

      - Ian

      Comment


      • #4
        Ian
        You are most welcome.
        To add to my previous reply note that the upperDonchian() function is already based on the high() by default so if you are trying to define the highest High series you can write it as
        vHigh = upperDonchian(5,inv("D"));
        Alex

        Comment

        Working...
        X