This study (shown below)works properly as written in an historical basis (going backward in time) . But the most recent bars DO NOT SHOW UP.
Sometime this is for 5,6,7 bars and sometimes for 15 or more bars. What am I doing wrong ?
Thanks in advance for your help.
function preMain() {
setPriceStudy(true);
setStudyTitle("MARC");
setShowCursorLabel(false);
}
var vColor = null;
function main() {
if (getBarState() == BARSTATE_NEWBAR)
vColor = null;
var c = close();
var c1 = close(-1);
var o = open();
var h = high();
var h1 = high(-1);
var h2 = high(-2);
var h3 = high(-3);
var h4 = high(-4);
var h5 = high(-5);
var h6 = high(-6);
var h7 = high(-7);
var h8 = high(-8);
var h9 = high(-9);
var h10 = high(-10);
var l = low();
var l1 = low(-1);
var l2 = low(-2);
var l3 = low(-3);
var l4 = low(-4);
var l5 = low(-5);
var l6 = low(-6);
var l7 = low(-7);
var l8 = low(-8);
var l9 = low(-9);
var l10 = low(-10);
if (c == null || c1 == null)
return;
if (c >= c1 && l <= l1 && l <= l2 && l <= l3 && l <= l4 && l <= l5 && l <= l6 && l <= l7 && l <= l8 && l <= l9 && l <= l10)
vColor = Color.red;
if (c <= c1 && h >= h1 && h >= h2 && h >= h3 && h >= h4 && h >= h5 && h >= h6 && h >= h7 && h >= h8 && h >= h9 && h >= h10)
vColor = Color.red;
if (vColor != null)
setPriceBarColor(vColor);
return;
}
Sometime this is for 5,6,7 bars and sometimes for 15 or more bars. What am I doing wrong ?
Thanks in advance for your help.
function preMain() {
setPriceStudy(true);
setStudyTitle("MARC");
setShowCursorLabel(false);
}
var vColor = null;
function main() {
if (getBarState() == BARSTATE_NEWBAR)
vColor = null;
var c = close();
var c1 = close(-1);
var o = open();
var h = high();
var h1 = high(-1);
var h2 = high(-2);
var h3 = high(-3);
var h4 = high(-4);
var h5 = high(-5);
var h6 = high(-6);
var h7 = high(-7);
var h8 = high(-8);
var h9 = high(-9);
var h10 = high(-10);
var l = low();
var l1 = low(-1);
var l2 = low(-2);
var l3 = low(-3);
var l4 = low(-4);
var l5 = low(-5);
var l6 = low(-6);
var l7 = low(-7);
var l8 = low(-8);
var l9 = low(-9);
var l10 = low(-10);
if (c == null || c1 == null)
return;
if (c >= c1 && l <= l1 && l <= l2 && l <= l3 && l <= l4 && l <= l5 && l <= l6 && l <= l7 && l <= l8 && l <= l9 && l <= l10)
vColor = Color.red;
if (c <= c1 && h >= h1 && h >= h2 && h >= h3 && h >= h4 && h >= h5 && h >= h6 && h >= h7 && h >= h8 && h >= h9 && h >= h10)
vColor = Color.red;
if (vColor != null)
setPriceBarColor(vColor);
return;
}
Comment