I am unable to get the text to 'stick' even though I am using drawtextRelative. When I first apply the study to a chart, the text appears on top of each bar, however, when the new bar forms, all the text on the previous bars disappears. Here's my code... please could someone help identify my error. Thanks
function preMain() {
setPriceStudy(true);
setShowCursorLabel(false);
}
function main() {
var pricemovement = ((close(0)*100)/open(0))-100
var pricemovementround = Math.round (pricemovement*10)/10
if (open(0)<close(0) && pricemovementround < 0.5) {
drawTextRelative( 0, AboveBar1, pricemovementround, Color.green, null, Text.PRESET | Text.BOLD, null, 12 );
}
if (close(0)<open(0) && pricemovementround < 0 && pricemovementround > -0.5) {
drawTextRelative( 0, AboveBar1, pricemovementround, Color.red, null, Text.PRESET | Text.BOLD, null, 12 );
}
}
function preMain() {
setPriceStudy(true);
setShowCursorLabel(false);
}
function main() {
var pricemovement = ((close(0)*100)/open(0))-100
var pricemovementround = Math.round (pricemovement*10)/10
if (open(0)<close(0) && pricemovementround < 0.5) {
drawTextRelative( 0, AboveBar1, pricemovementround, Color.green, null, Text.PRESET | Text.BOLD, null, 12 );
}
if (close(0)<open(0) && pricemovementround < 0 && pricemovementround > -0.5) {
drawTextRelative( 0, AboveBar1, pricemovementround, Color.red, null, Text.PRESET | Text.BOLD, null, 12 );
}
}