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!
}
}
- }
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