Place orders from Amibroker charts with a click

#1
Hello,

Is there a way in Amibroker to draw Entry, Stop Loss and Target lines and then with a click of a button place the same order as Cover or Basket order in the trading account?

Can someone give an AFL or an idea to make such AFL?

Thanks
Anuma
 
#2
This AFL can be easily constructed. Rather than drawing lines on chart, use following method:

(1) Save the Entry Stop Loss and Target in a CSV at a particular path. This will give you full flexibility. You will be able to apply one SLTP on entire basket or modify per scrip.
(2) Parse the path and read the values per scrip/basket.
(3) Create watchlist and run analysis on watchlist with Auto Refresh Interval (with desired periodicity).
(4) Program the trade execution in the AFL.

Amibroker will automanage all the positions and it will work like a charm.

Here's the file parsing snippet for your reference


fh = fopen( "D:\\target.csv", "r" );

if( fh )
{


while( ! feof( fh ) )
{
line = fgets( fh );
sym = StrExtract( line, 0 );
if ( Name() == sym )
{
symfound=1;
symtyp = StrExtract( line, 1 );
symsl = StrToNum( StrExtract( line, 2 ) );
sympos = StrToNum( StrExtract( line, 3 ) );
symactive = StrExtract( line, 4 );
}
}
}
 
#3
Thanks for the response!
The reason i was looking for lines on chart because i decide on Entry, SL & Target as i analyze chart, it would be easier to draw lines at the points i want than to note down the numbers.

Your approach thought me new things! If its not asking too much, can you please explain the logic of this code? Specially i didnt get the code 'while( ! feof( fh ) ) ' - how its read or what it does.

Thanks
Anuma