Text Label on the Chart at a fixed position

Is it possible to place a text label on the chart at a fixed position so that it is always visible?

There is a possibility to add a text label but its location is fixed on that chart and as the time goes on, text label moves to left and eventually its not visible on the chart.

Is it possible to place a text label on the chart so that it is always visible around top right corner?

Here are the GFX text functions that you will need.
https://www.amibroker.com/guide/afl/gfxselectfont.html
https://www.amibroker.com/guide/afl/gfxsetbkmode.html
https://www.amibroker.com/guide/afl/gfxsetbkcolor.html
https://www.amibroker.com/guide/afl/gfxtextout.html

2 Likes

Hi Peter,

Thank you for your response.

I am looking for something like Anchored Text tool like the one we have in trading view.

I want to make some quick notes/labels on the chart which can be sticky.

So, these GFX functions will not help in solving my situation.

Thanks

It is possible with version 6.93, by checking "Use pixel co-ordinates" in Text Properties box.

2 Likes

Thanks @Tomasz .

1 last question: How to change the default text color, font style or always use the last used color and size. Please advise. Thanks.

I found the way to change defualt font and font size. They are available in Tools -> Preferences -> Text Box.

However, I could not find a way to change default color and default the option to use pizel co-ordinates.

Please advise.

Color is just last used. As to co-ordinates, there can't be "default coordinates" because co-ordinates are set WHERE you place the mouse when adding the drawing.

This makes sense.

This is not working. Not sure if I am doing anything wrong. Can you please test it on your side?

Is it possible to set the "Use pixel co-ordinates" as the default option?

Also, default font and font size set under Tools -> Preferences -> Text Box is not working either.

Please advise.

Default font is ALWAYS Arial, 9pt. And no you can't have "Use pixel coordinates as "default" option because it doesn't make sense. ALL kind of drawings by default are always positioned relative to date and price.

I reread your post. I think GFX should work for you.
Is this what you need?
aapl

1 Like
GfxSetCoordsMode(0); GfxSetBkMode(1);
GfxSetBkColor(colorBlack); 				// BG colour
GfxSelectFont("Verdana", 11.5, 300);	// font, size, weight
GfxSetTextColor(colorWhite);			// colour
offset = -50; 							// plus or minus
GfxTextOut( "hi", Status("pxchartright")+offset ,10);

Because this code is in formula, it will appear for all symbols, text box tool will be symbol/chart specific as it is a study.

Unfortunately, you never described exactly what you want to achieve.

Thanks for clarification. Appreciate your help.

Hi Peter,

Thanks for your response. As @nsm51 stated, I would have been more clearer in my message stating that I would like to have a label that is chart specific without involving any coding.

Will try to ask questions more clearly going forward.

Sorry, I didn't read your reply carefully. I am going to suggest using NoteGet() function. Please note that Tomasz discourages the use of Notepad. Put NoteGet(Name()) in the text string of GfxTextOut function. Just key in whatever in the Notepad and click next ticker symbol to get it updated. Just delete the text string from Notepad and it will disappear from screen. As for the position of the text, you need to play with the get cursor position functions. The power of Amibroker AFL. :grinning:

This is another good alternative. Thanks for the tip.