Issue:
I am running AB-64bit. I incorrectly installed the IBcontroller with the default settings and it put it in:
C:\Program Files (x86)\Amibroker
After reading a ton of posts, I read somewhere about the 32 vs 64bit locations, so I deleted everything from the: C:\Program Files (x86)\Amibroker, and deleted all registry items I could find containing "BrokerIB".
I reinstalled pointing the install to the 64bit folder:
C:\Program Files\Amibroker
I still cannot get the following simple sample AT script to communicate with the IBcontroller app:
SetChartOptions( 2, chartWrapTitle );
RequestTimedRefresh( 1 );
BuyOrderTrigger = ParamTrigger( "Place Buy order on TWS", "BUY" );
SellOrderTrigger = ParamTrigger( "Place Sell order on TWS", "SELL" );
CancelOrderTrigger = ParamTrigger( "Cancel order on TWS", "CANCEL" );
TransmitTrigger = ParamTrigger( "Transmit Order", "TRANSMIT" );
ibc = GetTradingInterface( "IB" );
//ibc.SetInfoAccount("F1234A");
OrderID = StaticVarGetText( "OrderID" );
ORderStatus = ibc.GetStatus( ORderID, True );
if ( BuyOrderTrigger )
{
OrderID = ibc.ModifyOrder( OrderID, Name(), "Buy", 100, "MKT", 0, 0, "Day", TransmitTrigger );
StaticVarSetText( "OrderID", OrderID );
}
if ( SellOrderTrigger )
{
OrderID = ibc.ModifyOrder( OrderID, Name(), "Sell", 100, "MKT", 0, 0, "Day", TransmitTrigger );
StaticVarSetText( "OrderID", OrderID );
}
else
if ( CancelOrderTrigger )
{
OrderID = StaticVarGetText( "OrderID" );
ibc.CancelOrder( ORderID );
}
else
if ( TransmitTrigger )
{
if ( ibc.IsOrderPending( ORderID ) )
ibc.Transmit( ORderID );
}
OrderID = StaticVarGetText( "OrderID" );
LastTWSMsg = ibc.getLastError( ORderID );
Title = "\n" +
" OrderID: " + ORderID + "\n" +
"Last TWS Error Msg: " + LastTWSMsg + "\n" +
"Order Status at IB: " + ORderStatus + "\n" +
" TWS Position Size: " + NumToStr( ibc.GetPositionSize( Name() ), 1.0, False );
No matter what I do I get "COM/object handle is null".
I put it on my secondary computer, installing to the correct folder the first time and everything works.
I am thinking it is a registry or setting file somewhere pointed to the wrong folder because after the install into the 64bit folder I went to unlock the app, yet it still had my name and unlock code. So something is remaining from the wrong install.
I have read in other posts that @Tomasz says you can just copy/paste the BrokerIB.exe and BrokerIB.xml to the C:\Program Files\AmiBroker, and then set the properties of BrokerIB.exe to "Run as Admin". But no matter what I do, I still get the "COM/object handle is null" error when trying to Apply this AFL on my main machine.
I even went nuclear and Revo Uninstalled Amibroker and reinstalled, but it still remembered my unlock info, so something.... somewhere.... is holding onto the first install in the 32bit folder (I think!). I've searched the C:, including AppData, but I just cannot find it.