How to display text data in Amibroker chart screen irrespective of co-ordinates ?

Taiki

Well-Known Member
#1
Hi All,

I am complete new to Amibroker and just wrote my first AFL code. Here my code generates some string data (like major support, resistance level, buying, selling area etc.) and I need to display the data in my chart's visible area, but that should not be dependent on y axis value.

I mean i need that bunch of data to be displayed at a particualr region, say at top-right or bottom-left corner.

I searched and found about plottext(), but this needs x, y co-ordinates and if the given co-ordinates are not coming in visible range the data are not shown.

Can some one show some light what should be the general approach.

Regards
Taiki
 
Last edited:

manojborle

Well-Known Member
#2
Hi All,

I am complete new to Amibroker and just wrote my first AFL code. Here my code generates some string data (like major support, resistance level, buying, selling area etc.) and I need to display the data in my chart's visible area, but that should not be dependent on y axis value.

I mean i need that bunch of data to be displayed at a particualr region, say at top-right or bottom-left corner.

I searched and found about plottext(), but this needs x, y co-ordinates and if the given co-ordinates are not coming in visible range the data are not shown.

Can some one show some light what should be the general approach.

Regards
Taiki
Please check varset() function if it can be helpful.
 

Taiki

Well-Known Member
#3
Please check varset() function if it can be helpful.
What I found is varset () has nothing to do with the question that I asked.

I am not sure if you have understood the question well. I have all the data already generated, and now i just want to display that on my charting screen.

Lets say, I want to display " Buy above 500". I want to display the text at a particular region, like may be top-right corner, or bottom-left corner. The problem with PlotText() function is it needs x and y cordinate. And If i set the X and Y co-ordinate value based on the last bar location, then the text is overlapping with the bars.

So i need something like the text data will be displayed at a fixed area on chart, irespective of the bar size and y axis value.

Or can you please show ho varset() be a help here ??
 

KelvinHand

Well-Known Member
#4
What I found is varset () has nothing to do with the question that I asked.

I am not sure if you have understood the question well. I have all the data already generated, and now i just want to display that on my charting screen.

Lets say, I want to display " Buy above 500". I want to display the text at a particular region, like may be top-right corner, or bottom-left corner. The problem with PlotText() function is it needs x and y cordinate. And If i set the X and Y co-ordinate value based on the last bar location, then the text is overlapping with the bars.

So i need something like the text data will be displayed at a fixed area on chart, irespective of the bar size and y axis value.

Or can you please show ho varset() be a help here ??
You need to go to learn the low level graphic on all GFX related functions
http://www.amibroker.com/guide/h_lowlevelgfx.html.

These Gfx functions are directly related to microsoft window Graphic API
example your can try out:
Code:
//-- Top Left Corner
GfxSetBkMode( 1 );
GfxSelectFont("Arial", 10, 400, False, False, 0);
GfxSetTextColor(colorLime);

GfxTextOut( "Buy above 500", 10, 10);
 
Last edited:

manojborle

Well-Known Member
#5
GfxTextOut
- writes text at the specified location Low-level graphics
(AFL 3.0)


SYNTAX GfxTextOut( ''text'', x, y )
RETURNS NOTHING
FUNCTION Writes a character string at the specified location using the currently selected font.

Parameters:

"text" - Specifies the character string to be drawn
x - Specifies the x-coordinate of the starting point of the text
y - Specifies the y-coordinate of the starting point of the text
Character origins are at the upper-left corner of the character cell. By default, the current position is not used or updated by the function.
The font used can be set using GfxSelectFont() function. Text color can be set using GfxSetTextColor() function.

If a formula needs to update the current position when it calls GfxTextOut, the formula can call the GfxSetTextAlign function with flags set to 1 (TA_UPDATECP Windows flag). When this flag is set, GfxTextOut function ignores the x and y parameters on subsequent calls to GfxTextOut, using the current position instead.

The output of this function is NOT clipped. If you want clip text to user-defined rectangle, use GfxDrawText() function instead.

NOTE: This is LOW-LEVEL graphic function. To learn more about low-level graphic functions please read TUTORIAL: Using low-level graphics.

EXAMPLE GfxSelectFont("Times New Roman", 16, 700, True );
GfxTextOut("Percent of shares held by:", 10 , 10 );
SEE ALSO GfxLineTo() function , GfxMoveTo() function , GfxSetPixel() function
 

Taiki

Well-Known Member
#6
Thank you Manoj and Kelvin, Thanks a lot :)
 

Similar threads