The following code below is what I use
Once (RealTIme) Begin Condition1 = NtSetUp(Server, 36973); Condition1 = NtConnected(0); hasData = SubscribeMarketData(GetSymbolName); End; bidValue = 0.0; askValue = 0.0; If NtConnected(0) Then Begin bidValue = NTMarketData(1); askValue = NTMarketData(2); End Else Begin Condition1 = NtSetUp(SERVER, 36973); hasData = SubscribeMarketData(GetSymbolName); End;
The NTMarketData is just a function wrapper for:
NTMarketData = MarketData(GetSymbolName, PriceType);
I changed the code once to request data (that is call SubscribeMarketData) every time before reading the data. This worked fine for a while but eventually I notice the CPU running at 100% and NT GUI Hanging. It appears that it could not handle that amount of requests.
I believe that at some point NT stops pulling the data from IB and it just returns the last value. This is very important for FX trading.
Moscu.
Comment