I'm trying to build a system which runs a batch, runs a scan, adds the results to a watchlist, then fires a market order at the broker.
I have tried using various functions and I am unsure how to iterate through the watchlist (or even if I should be doing that.
I know I should trype some code here to display what I have done, but I'm embarrassed that I am just running orund in a vortex and have no idea how to achieve what I am trying to do.
Here's one of my many attempts.
Thanks so much, Peter, that was helpful.
This works;
ibc = GetTradingInterface("IB");
if( ibc.IsConnected() )
{
list = CategoryGetSymbols(categoryWatchlist,0,0);
for( i = 0; ( symbol = StrExtract( list, i ) ) != ""; i++ )
{
ibc.PlaceOrder(symbol+"-LSE-STK-GBP", "BUY", 1, "MKT", 0, 0, "GTC", True );
}
}
I note that the CategoryGetSymbols function takes a number for the watchlist. I tend to rename my watchlists to keep track of pending orders, open positions and which position is open in which position etc. I'm guessing I simply need to keep track of where that watchlist is in the order of watchlists. That's easy enough though. I'm happy with this solution, thanks.