Announcement

Collapse
No announcement yet.

Order of Operation in EFS

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

  • Order of Operation in EFS

    I have a strange question about order of operation in the body of the main in an EFS.

    If I have something like:

    main {

    do action A;

    do action B;

    myMA_FAST = study5.getValue(MAStudy.MA);
    myMA_SLOW = study6.getValue(MAStudy.MA);
    myTICK = "$TICK,1";
    myTICK_O = open(0, 1, myTICK)*1;
    myTICK_H = high(0, 1, myTICK)*1;
    myTICK_L = low(0, 1, myTICK)*1;
    myTICK_C = close(0, 1, myTICK)*1;

    }

    The situation is that action A and B use values of myMA_FAST, myMA_SLOW, and various myTICK variables. The reason I get the values from the end is so that in the backtest portion, when I am looking at the current bar, I am making decisions based only on the data from the previous bar.

    The funny thing, is that the values for myMA_FAST and myMA_SLOW in action A and action B are from the previous bar when evaluated, but the value for the myTICK variables are actually for the current bar even though technically the call was not made yet. Am I missing something?

    I know this is a simple concept, but I just thought that perhaps I am missing something fundamental in how these calls are made.

    Thanks as always . . .

    Thomas.

  • #2
    Are you running this on a 1 minute chart?
    Are all the variables local globals?

    Garth
    Garth

    Comment


    • #3
      Thomas
      If you want the values of $TICK for the prior bar you can use close(-1,"$TICK") or high(-1,"$TICK") etc.
      Alex

      Comment


      • #4
        update . . .

        That is exactly what I did to solve the problem, they are all local variables, just the part that gets me is that the value is contained before the call is made . . . . not a major issue, just wondering.

        T

        Comment

        Working...
        X