Page 1 of 1

Text_float function

Posted: 21 Dec 2011
by arnie
Hi.

I need help regarding the text_float function.
Please see attached image.

The text_float function uses the set_textstyle horizontal and vertical parameters centered on the last bar, which, as seen on the chart, lay half the text on top of previous bars.

My idea is to plot the text to the right of the last bar. I thought creating a second function, changing the text_setstyle parameters, but for some reason I'm receiving an error when trying to compile it - assignment is allowed only for variables or array elements which is a strange error when I copy/paste the code. The only change made was the horizontal parameter from 2 to 0.

What am I doing wrong?

Code: Select all

inputs:
TextID( numericsimple ),

TextBarsBack( numericsimple ),

TextPriceValuePercent( numericsimple ) ;

variables:
var0( false ),
var1( 0 ),
var2( 0 ),
var3( 0 ) ;

if LastBarOnChart then
begin
var0 = Text_Exist( TextID ) ;
if var0 then
begin
var1 = GetAppInfo( aiHighestDispValue ) ;
var2 = GetAppInfo( aiLowestDispValue ) ;
var3 = var2 + 0.01 * TextPriceValuePercent *
( var1 - var2 ) ;
Text_SetLocation( TextID, Date[TextBarsBack], Time[TextBarsBack],
var3 ) ;
Text_SetStyle( TextID, 0, 2 ) ;
end
else
RaiseRunTimeError( "TextID does not exist." ) ;
end ;

Text_Float = 1 ;

Re: Text_float function

Posted: 21 Dec 2011
by TJ
Hi.

I need help regarding the text_float function.
Please see attached image.

The text_float function uses the set_textstyle horizontal and vertical parameters centered on the last bar, which, as seen on the chart, lay half the text on top of previous bars.

My idea is to plot the text to the right of the last bar. I thought creating a second function, changing the text_setstyle parameters, but for some reason I'm receiving an error when trying to compile it - assignment is allowed only for variables or array elements which is a strange error when I copy/paste the code. The only change made was the horizontal parameter from 2 to 0.

What am I doing wrong?

...
the answer is hidden in this line:

>...which is a strange error when I copy/paste the code.

What did you copy to?

Re: Text_float function

Posted: 22 Dec 2011
by arnie

the answer is hidden in this line:

>...which is a strange error when I copy/paste the code.

What did you copy to?
Hi TJ.

I selected all tex_float function code, copied it and then pasted it all to a new created function, that was it.

Both functions are identical now and I can't compile the new one.

Can't functions recognize pasted codes?

Re: Text_float function

Posted: 22 Dec 2011
by TJ

the answer is hidden in this line:

>...which is a strange error when I copy/paste the code.

What did you copy to?
Hi TJ.

I selected all tex_float function code, copied it and then pasted it all to a new created function, that was it.

Both functions are identical now and I can't compile the new one.

Can't functions recognize pasted codes?
Yes... but WHAT did you copy to?

did you copy the code to a new function called Text_Float?

see this line in the bottom of the code?

Code: Select all

Text_Float = 1 ;
it is saying, return value "1" to the function Text_Float.

but since you have copied the code to a new function with a different name,
the PLE could not find Text_Float, thus giving you the error message.

Re: Text_float function

Posted: 22 Dec 2011
by arnie
see this line in the bottom of the code?

Code: Select all

Text_Float = 1 ;
it is saying, return value "1" to the function Text_Float.

but since you have copied the code to a new function with a different name,
the PLE could not find Text_Float, thus giving you the error message.
Damn......

What can I say... so obvious, but at the same time...

Once again thank you TJ for your precious insight.

Regards,
Fernando