Hi ,
I have been using the " if hour minute " method to draw a line of the hi of the 1st half hour ( as an example ) for today's 1 minute chart precisely at the start and end of this trading day.
I am able to use the " RELATIVETOLEFT " method to draw the text of the value on the chart.
However, I would like to have the text drawn at a constant distance to the right of the current bar.
I think I need to declare the variable correctly, and have tried the throw it at the wall and see what sticks method, but that didn't work.
Any directions are greatly appreciated.
Thank You Once Again,
Glenn
function preMain() {
setPriceStudy(true);
}
function main() {
if(getBarState()==BARSTATE_NEWBAR){
if ( hour(0) ==10 && minute(0) ==0 ) {
Hi3 = high( -1, inv(30) ) ;
drawLineRelative( -29, Hi3, 360, Hi3, PS_SOLID, 2, Color.yellow, 0);
drawTextRelative( 100, Hi3, Hi3, Color.yellow,null,Text.VCENTER|Text.RELATIVETOLEFT ,"Calibri",14, 0);
}
// Would Like to pass variable Hi3 outside of the previous " } "
// in order to draw text a constant distance to the right of the current bar instead of relative to left
}
}
I have been using the " if hour minute " method to draw a line of the hi of the 1st half hour ( as an example ) for today's 1 minute chart precisely at the start and end of this trading day.
I am able to use the " RELATIVETOLEFT " method to draw the text of the value on the chart.
However, I would like to have the text drawn at a constant distance to the right of the current bar.
I think I need to declare the variable correctly, and have tried the throw it at the wall and see what sticks method, but that didn't work.
Any directions are greatly appreciated.
Thank You Once Again,
Glenn
function preMain() {
setPriceStudy(true);
}
function main() {
if(getBarState()==BARSTATE_NEWBAR){
if ( hour(0) ==10 && minute(0) ==0 ) {
Hi3 = high( -1, inv(30) ) ;
drawLineRelative( -29, Hi3, 360, Hi3, PS_SOLID, 2, Color.yellow, 0);
drawTextRelative( 100, Hi3, Hi3, Color.yellow,null,Text.VCENTER|Text.RELATIVETOLEFT ,"Calibri",14, 0);
}
// Would Like to pass variable Hi3 outside of the previous " } "
// in order to draw text a constant distance to the right of the current bar instead of relative to left
}
}
Comment