How to create Amibroker textbox


I am AIMING for manual trading/semi-automated trading.Few trouble which I have faced using AFL hence asking.The

  1. How can I place a textbox inside the chart in amibroker?Is this possible?

         Why would I want it? I want to place stoploss value directly from the chart. I understand there are several other ways to do it but this is kinda my requirement
  2. Also how can I attach a default STUDY to any of the shape(for example horizontal line).

3.How can I create e button in the toolbox ,a custom button and attach my own layout popup?For example I want a custom button like the ‘buy’ button and once I click on it,i want my popup to come up

4.I want to create/use a icon/shape which is draggable in the chart.I want this primarily to put stop loss.I just drag the shape below some bar and execute order.Is this possible?How?

Afl code to place your custom value displayed on Amibroker charts.

Replace Last traded price and +c with your custom variables displayed on charts.

GfxSetOverlayMode( 0 );
GfxSelectPen( colorRed, 3 );
GfxSelectSolidBrush( colorLightYellow );
GfxRoundRect( 350, 38, 665, 70, 15, 15 );
GfxSetBkMode( 1 );
GfxSelectFont( "Arial", 17.5, 700, False );
GfxSetTextColor( colorBrown );
GfxSetTextAlign( 0 );
GfxSetTextColor( colorBlack );
GfxTextOut( " Last Traded Price = " + C , 350, 40 );

Rest of the requirements, will check and update you.



(Authorized data vendor of NSE supporting realtime data feeds to Amibroker,Metastock and Ninjatrader)

1 Like

In case some one hits upon the question,I found a workaround for the 4th point. Instead of draggable shape,the stoploss would be the line created when the user clicks on the chart.Internally this value can be taken hold of and passed into the api
function OnLButtonIsDown( x, y, px, py )
//_TRACE("x= "+x+"y= "+y+“px=”+px+“py=”+py);
function EventHandler()
local b, x, y, px, py;
b = GetCursorMouseButtons();
// retrieve co-ordinates in date/value units
x = GetCursorXPosition( 0 );
y = GetCursorYPosition( 0 );
// retrieve co-ordinates in pixel units
px = GetCursorXPosition( 1 );
py = GetCursorYPosition( 1 );
if( b == 9 ) OnLButtonIsDown( x, y, px, py ); // button pressed
//RequestTimedRefresh( 1 );