Announcement

Collapse
No announcement yet.

Every Tick Study Update

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

  • Every Tick Study Update

    Main function is executed for EVERY tick coming in.
    This distorts the results for any study that saves results from previous bars to be used in current bar.
    Example:

    var myVar;

    PreMain{ ... }
    Main{
    .....
    myVar = myVar + something;
    .....
    return(myVar);
    }

    will update "myVar" EVERY TICK (!?!) when watched in real time.

    Is there an option to run Main only ONCE per each bar?
    NOTE: This problem shows ONLY for bars that are watched in real time. Historical calculations are correct.
    Thank you.
    Mihai Buta
    Mihai Buta

  • #2
    You can do a few things, if you don't want this to happen.

    1) Set ComputeOnClose(true) in preMain. This will be specific to this EFS

    2) click on the tools menu near the top of the eSignal window and select "EFS settings" turn on "Make all formulas compute on close". This will cause all EFS formulas only compute on the closing bar.

    3) Put those sections you only want run on closing bar basis inside a check for NEWBAR as follows:

    var nState = getBarState();
    if (nState == BARSTATE_NEWBAR){
    // Put your code here
    }

    Hope this helps.
    Garth

    Comment


    • #3
      Thank you.
      First solution worked. Did not try the last one.
      Notes:
      1. Rev 7.1 does not have any choices for "EFS Setting", like you mention.
      2. The setComputeOnClose function is not listed in your reference guides available online.

      Mihai Buta
      Mihai Buta

      Comment

      Working...
      X