View Full Version : Market Position value
I am occasionally running into a problem where I cancel an order or it gets filled and then I check the MarketPosition value and it is not accurate. I am using IB. It seems it becomes up to date after an event in the log with a category of "Position" occurs. The Position update I am looking at in my log right now took 24 seconds from when the order was filled. Is that your understanding that the MarketPosition will not be accurate until that Position event occurs? Is there any way to force that Position event to occur or to know programmatically if it has occurred?
NinjaTrader_Ray
06-13-2006, 01:51 AM
That is correct, their is an internal position event that is thrown which in turn triggers the update in the log and the buffer that holds the position data for the ATI. The position event for IB is triggered by TWS itself. Therefore, if their is a 24 second lag its because TWS has not sent the update for 24 seconds. This is a limitation on their side. You could check the order status of the order to see if the position event will ultimately fire.
muthaf
07-03-2006, 08:35 PM
Is is the case if you are connected to Sim101 only that the NTMarketPosition always remains 0? I cannot seem to get any value other than 0 from it at any time. What I want toknow is if I close a position that it has been successfully executed.
NinjaTrader_Ray
07-04-2006, 02:17 AM
Should not be the case. If you can reproduce each time, please provida a small test script that we can test against.
muthaf
07-05-2006, 03:04 AM
What I've done is change your "NT Sample.efs", changing the NTCommand to use "FDAX 09-06" as the instrument of choice rather than the getSymbol(). I've also had quite a hassle in running it at first but managed to get the latest software and still have an issue with it. Running v5.2.1000.2
The amended version is available in the post.
NinjaTrader_Ray
07-05-2006, 03:37 AM
If you use the original script, does it work as you expect?
muthaf
07-05-2006, 10:56 AM
The only thing I've changed is to replace the getSymbol function based on the previous issueof NT5 having problemsresolving eSignal DAX codes (AX U6-DT to FDAX 09-06). What I am looking for is the capability of knowing how many contracts I have in the market right now so that I can plan further moves. I am considering strategies but will want to run multiple strategies at the same time.
My expectation is that hard-coding the symbol should not stop the function from working and in other scripts I've run NTMarketPosition with blank parameters and also explicit parameters for symbol and account.
muthaf
07-13-2006, 04:02 AM
I've now fixed my MarketPosition issue. It amounted to PEBKAC when adjusting the NT functions to work with FDAX.
Thanks for your patience...