Announcement

Collapse
No announcement yet.

When main() is called by eSignal

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

  • When main() is called by eSignal

    Does anyone know what the basic sequence is when eSignal is running an EFS script in real time . By that I mean, does the main() function in an efs script get called multiple times per bar or only once per bar ?

    I ask because I created an indicator, but sometimes it gives a false signal during say a 15 min bar. I assume eSignal is calling main() multiple times per bar.

    If thats the case, is it true to say that the only sure way to base a trade decision on an indicator chart value is after the bar is over and the next bar has started ?

  • #2
    Re: When main() is called by eSignal

    Danclark
    main() is called once per bar on historical bars as the formula is loading and then once on every trade on the current bar assuming you did not use a setComputeOnClose() statement in preMain() or did not enable the global compute on close (see also section 1.4 of the Beginner Tutorial 1 - EFS Basic and Tools)
    Alex


    Originally posted by dancclark
    Does anyone know what the basic sequence is when eSignal is running an EFS script in real time . By that I mean, does the main() function in an efs script get called multiple times per bar or only once per bar ?

    I ask because I created an indicator, but sometimes it gives a false signal during say a 15 min bar. I assume eSignal is calling main() multiple times per bar.

    If thats the case, is it true to say that the only sure way to base a trade decision on an indicator chart value is after the bar is over and the next bar has started ?

    Comment


    • #3
      Thanks. I have my efs draw a line on the screen if a certain numeric level is reached, but if I'm watching the chart in real-time on a 15 min chart, I see the line drawn sometimes, and then it disappears. If main() is called once, I guess that would imply that the code within main() is being constantly run while the current '0' bar is open ?

      What else could explain the behavior I described unless the code was being continuously run , since I have something just like this in my main() in the EFS code:

      if (value >= x) drawLineRelative(...

      Comment

      Working...
      X