Comment on Pi Bridge for Amibroker

CHOKS commented on 28 Jan 2015, 10:13 PM

Hi Pravin,
If u r subscribed for GDFL dataplan,then U might hav GDFL trading Plugin enabled which has function called symbol Mapper..U might hav known…It’s a csv file placed in C:\program files\Amibroker\Formulas\GDFL-NEST\GFDL_NEST_Symbol_Mapper.csv.Just open it , in col A enter the symbol in Amibroker i.e CIPLA-I and in col B enter the respective trd symbol i.e CIPLA29JANFUT…Likewise u add all symbols in database leave the first row or header and save it in the same file format i.e.csv
then
Just Copy the Below Code and Paste at the end of your AFL i.e. before
_SECTION_END();

When U Copy Paste from ZConnect, the Double Quotation mark will Change in AFL, So ReType all Double Quotation Marks after copy Paste. and Change the Client ID parameters with Urs…

That’s all U hav to do..Whenever the buy/sell signal generated on chart, it’ll automatically compare the symbol on chart in csv file and respective trade symbol ‘ll be added to the brd.Placeorder Just in the parametr window set ur Order Type , lot size etc…it’ll work for all symbol in database…

///——————————————–\\\\\

ClientId = “DP0012″;//Change As per Your client ID
Symbol = StrFormat(Name()+”-EQ”);
QYT = Param(“Lot Size?”,1,1,25,1);
Exch =ParamList(“Select Exch?”, “NFO|BFO|NSE|BSE|CDS|MCX” );
PType = ParamList(“Product Type?”, “MIS|NRML|CNC” );
OType = ParamList(“Order Type?”, “L|MKT|SL|SL-M” );

OT_SNM = “Use Symbol Mapper Dictionary”;
OT_SN =”NOTHING”;
GFDL_OT_SM(OT_SNM,OT_SN);

BuyP = LastValue(ValueWhen(Buy,C),1);
ShortP = LastValue(ValueWhen(Short,C),1);
SellP = LastValue(ValueWhen(Sell,C),1);
CoverP = LastValue(ValueWhen(Cover,C),1);

Checkone=Nz(StaticVarGet(“Check”),0);
Checktwo = LastValue(BarIndex(),1);
OrdCond=LastValue(Buy) OR LastValue(Short) OR LastValue(Sell) OR LastValue(Cover);

Brd = Null;

if(OrdCond AND CheckOne != CheckTwo)
{
brd = CreateStaticObject(“pibridge.Bridge”);

if(LastValue(Buy))
{
brd.PlaceOrder (Exch, OT_FSN ,Symbol,”MyAFL”, 1,Qty,0, BuyP, 0, OType, PType, ClientId,”DAY”);
}

if(LastValue(Sell))
{
brd.PlaceOrder (Exch, OT_FSN,Symbol,”MyAFL”, 2,Qty,0, SellP, 0, OType,PType, ClientId,”DAY”);
}

if(LastValue(Cover))
{
brd.PlaceOrder (Exch, OT_FSN,Symbol,”MyAFL”, 1,Qty,0, CoverP, 0, OType, PType, ClientId,”DAY”);
}

if(LastValue(Short))
{
brd.PlaceOrder (Exch, OT_FSN,Symbol,”MyAFL”, 2,Qty,0, ShortP, 0, OType,PType, ClientId,”DAY”);
}
StaticVarSet(“Check”,CheckTwo );
}

Reset = Ref(Buy,-1) OR Ref(Sell,-1) OR Ref(Short,-1) OR Ref(Cover,-1);
if(LastValue(Reset))
{
StaticVarRemove(“check”);
}

Alert = Buy OR Short OR Cover OR Sell;
AlertIf(Alert,”SOUND C:\\Windows\\Media\\Notify.wav”, “Audio alert”, 0 );

View the full comment thread »