PureBytes Links
Trading Reference Links
|
Hi,
I am trying to use Auto-Trader with an IB paper trading account. As
an example, buy when price crosses up thru it's 5 EMA and sell when
price crosses down thru it's 5 EMA. Seems simple enuff but I cannot
get thru the AFL check without an error. I would appreciate it very
much if someone would straighten me out on the proper way to do this.
Thx
//----------------------------------//
Buy = Cross((Close),(EMA(Close,5)));
if( LastValue( Buy ) )
ibc = GetTradingInterface("IB");
// check if we are connected OK
if( ibc.IsConnected() );
// check if we do not have already open position on this stock
if( ibc.GetPositionSize( "GM" ) == 0 );
// transmit order
ibc.PlaceOrder( "GM", "Buy", 100, "MKT", 0, 0, "Day", True );
Sell = Cross(EMA(Close,5),(Close));
if( LastValue( Sell ) );
// transmit order
ibc.PlaceOrder( "GM", "Sell", 100, "MKT", 0, 0, "Day", True );
Content-Description: "AVG certification"
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.1.409 / Virus Database: 268.13.27/517 - Release Date: 11/3/2006
|