Comment on Pi Bridge for Amibroker

CHOKS commented on 26 Jan 2015, 07:14 PM

Hi Pravin
It’s very simple
It all depends on from where u r getting data feeds and format of the symbol name in Ami Database.
I’ll explain for equity.
My database contains symbols of all Nifty stocks i.e CIPLA, TATMOTORS, BPCL etc
I just included the following in my AFL

Symbol = StrFormat(Name()+”-EQ”);//

What happens, if signal is generated for CIPLA,the AFL automatically create symbol as CIPLA-EQ

Normal AFL Symbol Specific;;;;

brd.PlaceOrder (“NSE”, “CIPLA-EQ”,”NIFTY”,”STRATEGYNAME”, 1,50,50, 780000, 0, “L”, “NRML”,
“DZ1105″,”DAY”);

So in place of “CIPLA-EQ” use Symbol
For All Symbols in DataBase
brd.PlaceOrder (“NSE”, Symbol ,”NIFTY”,”STRATEGYNAME”, 1,50,50, 780000, 0, “L”, “NRML”,
“DZ1105″,”DAY”);

So any signal generated on any symbol on any chart, ‘ll have that particular Trade symbol in the brd.PlaceOrder and orders ‘ll be fired to Pi.

For Qty
I’ll Explain wat I’m doing
I always want to invest 50000 per symbol ie my investment is fixed for all symbols at 50000;
So for Ex :
CIPLA ‘s mkt price is 659

Qty = ceil(50000/lastvalue(c,1)); i.e 75 Qty for CIPLA
Buyprice = Valuewhen(Buy,C);

For Each Symbol Qty ‘ll differ buy trade Value Remains same.

Just add Qty to brd.PlaceOrder as follows

brd.PlaceOrder (“NSE”, Symbol ,”NIFTY”,”STRATEGYNAME”, 1,Qty,0, Lastvalue(Buyprice,1), 0, “L”, “NRML”,
“DZ1105″,”DAY”);

For Futures, If u post ur Symbol format, if possible all Symbols and ur Investment, I’ll post AFL Code

Happy Trading

View the full comment thread »