Need a 2nd look. I'm trying to show buy and sell stops which are based on the previous bar. The first drawText "sell" is not drawing. Both arrows are being displayed and so is the 2nd drawText "buy". Need to understand why the first text is erased when the 2nd text is drawn and what the fix is.
PHP Code:
var nTick = .25;
function preMain() {
setPriceStudy(true);
}
function main() {
var nState = getBarState();
if (nState == BARSTATE_NEWBAR && getCurrentBarIndex() == 0) {
clearText();
clearShape();
nHi = high(-1);
nLo = low(-1);
nBuyStop = nLo-nTick;
nSellStop = nHi+nTick;
drawTextAbsolute(4, high(-1) + nTick, nSellStop, Color.red, Color.RGB(165,165,165), Text.ONTOP, null, 10), "sell";
drawShapeAbsolute(3, high(-1) + nTick, Shape.LEFTARROW, null, Color.RGB(255,0,0), Shape.ONTOP, "ss");
drawTextAbsolute(4, low(-1) - nTick, nBuyStop, Color.blue, Color.RGB(165,165,165), Text.ONTOP, null, 10), "buy";
drawShapeAbsolute(3, low(-1) - nTick, Shape.LEFTARROW, null, Color.RGB(0,0,255), Shape.ONTOP, "bs");
}
return;
}
Comment