How to open new order or pending order immediately? - page 3

 
01005379:
Possible. But why my code does not work as I want? Any idea?


You need some error reporting in case the trade fails, you only print when the order succeeds.

I have heard of brokers placing limitations on accounts that send too many order requests. Your while loops can send requests 100's or maybe 1000's of times in 1 second. If it fails the first time it is likely to fail the next time and so on. The only change that you make is with RefreshRates and this will not change until there is a new tick.

Reason: