After condition 1 becomes true E-signal is supposed to send 1 order to NT, but instead it is firing 2 orders one after another within the same second. I dont think NTmarketPosition is updating fast enough to reflect the success or failure of the first trade after it has sent.
Baically my code performs the following steps:
if previous order sent was either rejected, filled or partfilled in NT then
{
if Condition1 is true and marketposition in NT is zero, then, BUY 1 contract at Market price.
};
the reason why i put in the first line is to check to see if the previous order was either filled or rejected. which "should" mean that "NTmarketPosition" should have updated in real-time if we got a fill ie changed from 0 to 1. maybe this is where im wrong, as it still fires 2 orders within the same second. only 1 order should be fired by e-signal.
can someone please tell me what is wrong with my logic or steps im performing. the problem that i think im seeing is that while e-signal is sending the first order to NT and waiting for NTmarketposition to change from zero to 1, e-signal fires off another order to NT, as it still thinks NTmarketposition =0
i tried running my e-signal program only once every 2 seconds and this solves the problem as this means when the first order is sent there is 2 seconds available for NTmarketPosition to update from 0 to 1, and this is enough time to get the position status back from our broker, which means the same order does not get executed twice. But im not 100% happy with this solution, as its not perfect, as sometimes it might take longer than 2 seconds to get order confirmation and position status from our futures broker after an order has been submitted by my local computer.
Is there a better way to stop this problem of order duplication, using the OrderState() command in NT. if so how do i structure the code? just a list of some simple steps would help me immensely.
Upon thinking about it some more, maybe in simulation mode, im getting a "Filled" order state *before* NTmarketPosition is able to update from a 0 to +1, or a 0 to -1. If i get 10 ticks in a second, before NTMaketPosition value is updated in real-time, what is stopping e-signal from sending 10 buy orders to NT, when in fact i only want to send 1 order? How can I solve this problem?
Thanks in advance.
Regards
Rod
Comment