Announcement

Collapse
No announcement yet.

Calculate 'end of bar'

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

  • Calculate 'end of bar'

    if I use 'setComputeonClose(true);' will EFS ignore any calculations within the

    if(vState == BARSTATE_CURRENTBAR && false)
    {... } subroutine?

    or does the '&& false' already cause that part of the program to be ignored?

  • #2
    Re: Calculate 'end of bar'

    HawkArps
    FYI setComputeOnClose() does not use any parameter [see this article in the EFS KnowledgeBase] so even if you write setComputeOnClose(false) it will still force the efs to compute only on the close of a bar
    As to your conditional statement
    if(vState == BARSTATE_CURRENTBAR && false)
    assuming you could even write it that way this would mean
    “If the variable vState is equal to BARSTATE_CURRENTBAR and the variable false is true”
    - assuming that you have assigned getBarState() to the variable vState then it will never be equal to BARSTATE_CURRENTBAR if you have setComputeOnClose() as the script will execute once per bar only.
    - you cannot assign the name false to a variable as that is a JavaScript reserved word [see this article in the EFS KnowledgeBase]
    You may want to review the Beginner Tutorials which are in the EFS KnowledgeBase and specifically Beginner Tutorial 4 which relates to Bar State for more information on this
    Alex


    Originally posted by HawkArps
    if I use 'setComputeonClose(true);' will EFS ignore any calculations within the

    if(vState == BARSTATE_CURRENTBAR && false)
    {... } subroutine?

    or does the '&& false' already cause that part of the program to be ignored?

    Comment

    Working...
    X