Lock of OrderSend

33 views
Skip to first unread message

gplus hase

unread,
Feb 8, 2019, 3:03:07 AM2/8/19
to NJ4X Forum

I use C#.
I ran OrderSend with big volume.
But wait for 10 minutes will not proceed to the next line.
In the MT 4, an e-mail of OffQuote Error was received.
If volume is reduced, it will advance to the next line without problems.
This event is reproducible.

I want to get the next line even in a big volume.
It is troublesome to handle when locked. It is more convenient for me to have an exception.
How can I get the next step of OrderSend?


ticketNo = strategy.OrderSend(
                 symbol: symbol,
                 cmd: tradeOperation,
                 volume: lots,
                 price: price,
                 slippage: slippage,
                 stoploss: 0,
                 takeprofit: 0,
                 comment: "",
                 magic: magicNum,
                 expiration: expiration
                 );

I don't want to use Thread.Abort.
Due to the possibility of memory leak.
At strategy's method blocking, how can I cancel it?

Roman Gerasimenko

unread,
Feb 8, 2019, 3:11:32 AM2/8/19
to NJ4X Forum

пт, 8 лют. 2019 о 10:03 gplus hase <gplusk...@gmail.com> пише:

I use C#.
I ran OrderSend with big volume.
But wait for 10 minutes will not proceed to the next line.

It can mean that a broker does not have enough opposite orders on the Limit Orders Book in order to satisfy your order request.
 
In the MT 4, an e-mail of OffQuote Error was received.
If volume is reduced, it will advance to the next line without problems.
This event is reproducible.

If the hang is at mt4 terminal side, there will be problematic to fix this situation.
Anyway, I will check it if you provide account and order details for reproducing the issue. 

I want to get the next line even in a big volume.
It is troublesome to handle when locked. It is more convenient for me to have an exception.
How can I get the next step of OrderSend?


If you terminate the waiting thread it will not always mean termination of the actual order execution ...
I'm working on the async/away version of NJ4X API - there it will be possible to setup cancellation timeout.
 

ticketNo = strategy.OrderSend(
                 symbol: symbol,
                 cmd: tradeOperation,
                 volume: lots,
                 price: price,
                 slippage: slippage,
                 stoploss: 0,
                 takeprofit: 0,
                 comment: "",
                 magic: magicNum,
                 expiration: expiration
                 );

I don't want to use Thread.Abort.
Due to the possibility of memory leak.
At strategy's method blocking, how can I cancel it?

--
You received this message because you are subscribed to the Google Groups "NJ4X Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nj4x+uns...@googlegroups.com.
To post to this group, send email to nj...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

gplus hase

unread,
Feb 8, 2019, 4:30:06 AM2/8/19
to nj...@googlegroups.com
this is OrderSend Parameter.
I sent demo account id/pw to roman.ge...@nj4x.com.
Please check.

ticketNo = strategy.OrderSend(
                 symbol: "USDJPY-a",
                 cmd: 0,
                 volume: 2.8,
                 price: 0,
                 slippage: 100,

                 stoploss: 0,
                 takeprofit: 0,
                 comment: "",
                 magic: 44574086,
                 expiration: {1970/01/01 0:00:00}
                 );

2019年2月8日(金) 17:11 Roman Gerasimenko <roman.ge...@nj4x.com>:

Roman Gerasimenko

unread,
Feb 14, 2019, 10:38:02 PM2/14/19
to NJ4X Forum
I've discovered that passing zero OrderSend/price parameter indeed may result in the infinite loop of order execution.

Original error sent to terminal's mailbox is "Trade could not be completed due to Insufficient Liquidity in the market. Failed Trade: Type: BuyMarket  Symbol: USDJPY-a  Units: 280000"

As a workaround, please provide non-zero price parameter: https://i.imgur.com/2k87zF1.png

The fix for a zero-price case will be available in the next API release.

пт, 8 лют. 2019 о 11:30 gplus hase <gplusk...@gmail.com> пише:

gplus hase

unread,
Feb 26, 2019, 3:33:06 AM2/26/19
to nj...@googlegroups.com
When it becomes the infinite loop like this time,
Please tell me how to stop the infinite loop thread.

I tried and stopped using 'strategy.disconnect()'
But, this method requires reconnection.
Is there any other way?


2019年2月15日(金) 12:38 Roman Gerasimenko <roman.ge...@nj4x.com>:

gplus hase

unread,
Mar 7, 2019, 2:57:28 AM3/7/19
to nj...@googlegroups.com, Roman Gerasimenko
Please reply!

2019年2月26日(火) 17:32 gplus hase <gplusk...@gmail.com>:
Reply all
Reply to author
Forward
0 new messages