[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[amibroker] Amibroker AutoTrader



PureBytes Links

Trading Reference Links

Hi..
I am trying to implement a basic Amibroker auto trader order routine 
and am
having difficulties. On  bactests, when AB see's the BUY
array, it executes it. When it see's the SELL array, it gets executed
subsequently. Moreover, when AB see's the SHORT array, it gets
executed, and when AB see's the COVER aray, it also gets subsequently
executed and thus closing out the prior SHORT position. Does the auto
trader work the same way? Anyway, this the basic objective I am trying
to achieve. Here is the code I am trying implement, and it does not
work with IB's Demo TWS. Can someone please proof it for me and give
me a pointer or two on how to make it effective?

Thank you
Dennis

// ---------------------------------------

z=cci(14);

// Filters
Filter = (zlrlong OR zlrshort OR famirlong OR famirshort OR Vtlong OR
Hfelong OR Vtshort OR gb100long OR gb100short OR Hfeshort) OR (A OR
bars) AND 1 AND MA(V,50) > 100000;

Buy = (zlrlong OR famirlong OR Vtlong OR gb100long);

Sell= (z<Ref(z,-1) AND Ref(z,-1)<Ref(z,-2) AND C<O);

Short = (zlrshort OR famirshort OR Vtshort OR gb100short);

Cover = (z>Ref(z,-1) AND Ref(z,-1)>Ref(z,-2) AND C>O);


// AutoTrader

// Buy

if(LastValue(Buy))

{

ibc= GetTradingInterface("IB");

// check if we are connected OK

if(ibc.IsConnected())

{

//check if we do not already have open position on this future/stock

if(ibc.GetPositionSize(Name())==0)

{

//transmit order

parentid=ibc.PlaceOrder(Name(),"Buy",1,"MKTCLS",0,0,"Day",True);

if(LastValue(Sell))

{

ibc.placeorder(Name(),"SELL",1,"MKTCLS",0,0,"Day",True,parentid);

}

}

}

}



// Short

if(LastValue(Short))

{

ibc= GetTradingInterface("IB");

// check if we are connected OK

if(ibc.IsConnected())

{

//check if we do not already have open position on this future/stock

if(ibc.GetPositionSize(Name())==0)

{

//transmit order

parentid=ibc.PlaceOrder(Name(),"Sshort",1,"MKTCLS",0,0,"Day",True);

if(LastValue(Cover))

{

ibc.placeorder(Name(),"Buy",1,"MKTCLS",0,0,"Day",True,parentid);

}

}

}

}






------------------------ Yahoo! Groups Sponsor --------------------~--> 
Try Online Currency Trading with GFT. Free 50K Demo. Trade 
24 Hours. Commission-Free. 
http://us.click.yahoo.com/RvFikB/9M2KAA/U1CZAA/GHeqlB/TM
--------------------------------------------------------------------~-> 

Please note that this group is for discussion between users only.

To get support from AmiBroker please send an e-mail directly to 
SUPPORT {at} amibroker.com

For other support material please check also:
http://www.amibroker.com/support.html

 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/amibroker/

<*> To unsubscribe from this group, send an email to:
    amibroker-unsubscribe@xxxxxxxxxxxxxxx

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/