Announcement

Collapse
No announcement yet.

Sonething screwball about getBarStateInterval()

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

  • Sonething screwball about getBarStateInterval()

    My script seems to be hanging on the use of the getBarStateInterval(0) function.

    I reverted to an earler version of the script that didn't have this function and it started working again. But when I use this function, the script gets hung in a perpetual "Loading Data..." state.

    Here is a diff of my code in the versions that worked and didn't work.

    function upper_crossing(periods, sd, backcheck) {
    var ret = false;
    var ubb = upperBB(periods, sd, 0);
    var phigh = high(0);
    var plow = low(0);

    + if (getBarStateInterval(0) == BARSTATE_NEWBAR) {
    + crossing.upper = false;
    + }
    +
    if (plow <= ubb && ubb < phigh) {
    ret = true;
    for (var i = -1; i >= -backcheck; --i) {
    @@ -239,7 +246,18 @@
    ret = false; // already triggered!
    }
    }
    - }

  • #2
    Re: Sonething screwball about getBarStateInterval()

    flajann
    The syntax you are using for the getBarStateInterval() function is incorrect. The parameter needs to be a string that indicates the interval. For the description and required syntax of this function [together with an example of its use] see this article in the EFS KnowledgeBase
    Alex


    Originally posted by flajann
    My script seems to be hanging on the use of the getBarStateInterval(0) function.

    I reverted to an earler version of the script that didn't have this function and it started working again. But when I use this function, the script gets hung in a perpetual "Loading Data..." state.

    Here is a diff of my code in the versions that worked and didn't work.

    function upper_crossing(periods, sd, backcheck) {
    var ret = false;
    var ubb = upperBB(periods, sd, 0);
    var phigh = high(0);
    var plow = low(0);

    + if (getBarStateInterval(0) == BARSTATE_NEWBAR) {
    + crossing.upper = false;
    + }
    +
    if (plow <= ubb && ubb < phigh) {
    ret = true;
    for (var i = -1; i >= -backcheck; --i) {
    @@ -239,7 +246,18 @@
    ret = false; // already triggered!
    }
    }
    - }

    Comment

    Working...
    X