Gamestudio Links
Zorro Links
Newest Posts
Data from CSV not parsed correctly
by jcl. 04/26/24 11:18
M1 Oversampling
by jcl. 04/26/24 11:12
Why Zorro supports up to 72 cores?
by jcl. 04/26/24 11:09
Eigenwerbung
by jcl. 04/26/24 11:08
MT5 bridge not working on MT5 v. 5 build 4160
by EternallyCurious. 04/25/24 20:49
Trading Journey
by howardR. 04/24/24 20:04
Zorro FIX plugin - Experimental
by flink. 04/21/24 07:12
Scripts not found
by juergen_wue. 04/20/24 18:51
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
3 registered members (AndrewAMD, wandaluciaia, 1 invisible), 798 guests, and 6 spiders.
Key: Admin, Global Mod, Mod
Newest Members
wandaluciaia, Mega_Rod, EternallyCurious, howardR, 11honza11
19049 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 1 of 2 1 2
OrderLimit support and behaviour #471441
03/04/18 13:23
03/04/18 13:23
Joined: Dec 2013
Posts: 568
Fuerth, DE
Sphin Offline OP
User
Sphin  Offline OP
User

Joined: Dec 2013
Posts: 568
Fuerth, DE
Does the FXCM API support OrderLimit? If not is there any broker known that does?

As far as I know something like this should be prevented by OrderLimit or is it still a matter of slippage? From trade log:
Code:
[1158: Fri 18-03-02 14:17:01] (1.37795)
2018-03-02 14:17:55.4555
Asset: GBPUSD_FXCM, Price: 1.37750, Spread: 0.00001, Commission: 0.00007
OrderLimit: 1.37746
[GBPUSD_FXCM::S5254] Short 1@1.37694  at 14:17:55.


Is there a chance to simulate OrderLimit if it is not directly supported by the API or on MT4 accounts?

Thanks, Sphin

Re: OrderLimit support and behaviour [Re: Sphin] #471458
03/05/18 13:15
03/05/18 13:15
Joined: Jul 2017
Posts: 784
Z
Zheka Offline
User
Zheka  Offline
User
Z

Joined: Jul 2017
Posts: 784
You limit order to sell was below Bid and so got immediately converted into market.
Which - given your latency and a fast falling market - resulted in a significant slippage.

This would happen regardless of the broker/API.

Frequency of price updates from the API is another thing that will influence this behaviour(to be changed via TickTime).

Re: OrderLimit support and behaviour [Re: Zheka] #471469
03/05/18 16:46
03/05/18 16:46
Joined: Dec 2013
Posts: 568
Fuerth, DE
Sphin Offline OP
User
Sphin  Offline OP
User

Joined: Dec 2013
Posts: 568
Fuerth, DE
Sure?
Quote:
OrderLimit
Send a limit order at the given limit price, instead of a market order, to the broker at the next enterLong or enterShort call. This is different to an Entry limit. It does not produce a pending trade, but cancels the order if it is not filled within a few seconds, dependent on broker API. If the broker API supports limit orders, this guarantees a fill price at or better than the limit. [...]

Re: OrderLimit support and behaviour [Re: Sphin] #471471
03/05/18 17:50
03/05/18 17:50
Joined: Jul 2017
Posts: 784
Z
Zheka Offline
User
Zheka  Offline
User
Z

Joined: Jul 2017
Posts: 784
I am not familiar with nuances of FXCM plug-in.

But logically:

- if the plug-in does not support OrderLimit, then most probably the order went as just the market order

- if the plug-in does or were to support OrderLimit, then the order would be directly sent as 'limit' to the broker, where it would be subject to the usual limit order handling rules I described above.

Re: OrderLimit support and behaviour [Re: Zheka] #471474
03/05/18 18:35
03/05/18 18:35
Joined: Dec 2013
Posts: 568
Fuerth, DE
Sphin Offline OP
User
Sphin  Offline OP
User

Joined: Dec 2013
Posts: 568
Fuerth, DE
Logically I would say that
Quote:
if the plug-in does or were to support OrderLimit, then the order would be directly sent as 'limit' to the broker, where it would be subject to the usual limit order handling rules I described above.

and
Quote:
If the broker API supports limit orders, this guarantees a fill price at or better than the limit.

are not the same. The usual limit behaviour should be already covered by 'Entry', at least it is explained in the manual similar to your description. But who knows.

Re: OrderLimit support and behaviour [Re: Sphin] #471477
03/05/18 19:54
03/05/18 19:54
Joined: Jul 2017
Posts: 784
Z
Zheka Offline
User
Zheka  Offline
User
Z

Joined: Jul 2017
Posts: 784
Quote:
If the broker API supports limit orders, this guarantees a fill price at or better than the limit
This will normally be true if the limit price is "same or better" than the current.
But in this case it was "worse".
So, the order - already at the broker - got converted to market BY THE BROKER (nothing Zorro can do about it by then).
And in a fast falling market (with liquidity quickly removed on the bid side, i.e.bid price falling even faster) and with latency, you got 'slipped' vs the desired limit price.

Change the limit price to bid-ask mid-point. OrderLimit will then work as intended: if not executed quickly, the order will get cancelled and you can resubmit it again to chase the moving price but still guarantee favourable execution.

Re: OrderLimit support and behaviour [Re: Zheka] #471500
03/06/18 19:07
03/06/18 19:07
Joined: Dec 2013
Posts: 568
Fuerth, DE
Sphin Offline OP
User
Sphin  Offline OP
User

Joined: Dec 2013
Posts: 568
Fuerth, DE
If it works this way then it does.

My intention was to sell only if I get at least 1.37746 otherwise cancel the trade. But this is only possible if the actual bid is below my limit otherwise sending a market order has the same effect? That's bad because I simply don't know if the next price is above or below it so I have to guess. There is no other chance to realize this?

Re: OrderLimit support and behaviour [Re: Sphin] #471519
03/07/18 10:26
03/07/18 10:26
Joined: Jul 2017
Posts: 784
Z
Zheka Offline
User
Zheka  Offline
User
Z

Joined: Jul 2017
Posts: 784
What happened is quite a rare event, a very special case.
Had the movement been less swift, you would get executed at "market" - which will be better than 1.37746...
Of course, if the strategy is to trade around "news", then such situations might be happening more often.
Please give more details of a typical situation/approach.

What will help in any case is reducing latency between you and the broker, including: server location, frequency of price updates by Zorro, tuning of NIC/OS settings, efficiency of code, CPU speed.

Re: OrderLimit support and behaviour [Re: Zheka] #471531
03/07/18 18:37
03/07/18 18:37
Joined: Dec 2013
Posts: 568
Fuerth, DE
Sphin Offline OP
User
Sphin  Offline OP
User

Joined: Dec 2013
Posts: 568
Fuerth, DE
Quote:
Change the limit price to bid-ask mid-point

I hope to do it right but there seems to be not the desired effect:

2018-03-06 11:22:39.994
Asset: EURUSD_FXCM, Price: 1.23605, Spread: 0.00002, Commission: 0.00007
OrderLimit: 1.23604
[EURUSD_FXCM::L8224] Long 1@1.23701 at 11:22:40.

2018-03-07 09:17:29.427
Asset: GBPUSD_FXCM, Price: 1.38658, Spread: 0.00002, Commission: 0.00007
OrderLimit: 1.38657
[GBPUSD_FXCM::S6627] Short 1@1.38636 at 09:17:29

Do I have to set also a value for Entry when using OrderLimit? Up to now I didn't.

Re: OrderLimit support and behaviour [Re: Sphin] #471533
03/07/18 19:59
03/07/18 19:59
Joined: Jul 2017
Posts: 784
Z
Zheka Offline
User
Zheka  Offline
User
Z

Joined: Jul 2017
Posts: 784
I do not think you need Entry with OrderLimit; but you can experiment with Entry instead of OrderLimit.

The above is strange. Need to ask support if/how exactly Limit orders are supported with FXCM.
What if you set OrderLimit price 1 pip below bid (for long) in a calm market? Will it work properly at all?

What's your latency to FXCM server?

Re: OrderLimit support and behaviour [Re: Zheka] #471541
03/08/18 18:20
03/08/18 18:20
Joined: Dec 2013
Posts: 568
Fuerth, DE
Sphin Offline OP
User
Sphin  Offline OP
User

Joined: Dec 2013
Posts: 568
Fuerth, DE
Quote:
Need to ask support if/how exactly Limit orders are supported with FXCM.

This was my first sentence within this thread. laugh Normally I ask those questions, that might be also interesting to others, in the forum.

OrderLimit is available when the SET_LIMIT command is supported by the broker API (manual). Because SET_LIMIT is not listed in the manual at the FXCM API and because of my experience from above I guess it isn't supported by FXCM. As far as I can see only IB API supports SET_LIMIT propperly (MT4 does strange things).

Re: OrderLimit support and behaviour [Re: Sphin] #471549
03/09/18 08:45
03/09/18 08:45
Joined: Jul 2000
Posts: 27,986
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,986
Frankfurt
Yes, AFAIK OrderLimit is only for IB and the new Bittrex plugin at this point.

Re: OrderLimit support and behaviour [Re: jcl] #471583
03/10/18 14:49
03/10/18 14:49
Joined: Dec 2013
Posts: 568
Fuerth, DE
Sphin Offline OP
User
Sphin  Offline OP
User

Joined: Dec 2013
Posts: 568
Fuerth, DE
But OrderLimit is the only way to get surely filled at the limit price or better (or the trade will not be filled at all and is cancled) while using Entry limit Zorro sents a market order if the price crosses the limit resulting in slippage etc. or cancles the trade after EntryTime?

Re: OrderLimit support and behaviour [Re: Sphin] #471587
03/10/18 16:34
03/10/18 16:34
Joined: Jul 2017
Posts: 784
Z
Zheka Offline
User
Zheka  Offline
User
Z

Joined: Jul 2017
Posts: 784
Yes, but in a normal market it is more likely to be positive slippage.
For it to be negative, price has to just touch the limit and immediately retreat.

The danger is during volatile markets. Zorro triggers everything on Ask, and Ask and Bid can spike, triggerring stops/limits. So, negative slippage is more likely on the Short entries.
Some brokers add "Order execution options" to prevent such situations. https://alpari.com/en/trading/ecn_settings/

Since Entry limits are not sent to the broker anyway, you will be better off tracking the price mid-point in the script and just sending a market order yourself.

Of course, if the game is to "catch" a guaranteed fill during the news release then you need real limit orders residing at the broker server.

Re: OrderLimit support and behaviour [Re: Zheka] #471597
03/10/18 18:45
03/10/18 18:45
Joined: Dec 2013
Posts: 568
Fuerth, DE
Sphin Offline OP
User
Sphin  Offline OP
User

Joined: Dec 2013
Posts: 568
Fuerth, DE
Quote:
Some brokers add "Order execution options"

So does FXCM, but it seems only via Tradestation and not via API.

Re: OrderLimit support and behaviour [Re: Sphin] #471600
03/10/18 19:28
03/10/18 19:28
Joined: Jul 2017
Posts: 784
Z
Zheka Offline
User
Zheka  Offline
User
Z

Joined: Jul 2017
Posts: 784

Re: OrderLimit support and behaviour [Re: Zheka] #471618
03/11/18 10:38
03/11/18 10:38
Joined: Dec 2013
Posts: 568
Fuerth, DE
Sphin Offline OP
User
Sphin  Offline OP
User

Joined: Dec 2013
Posts: 568
Fuerth, DE
Maybe the version of Forexconnect on which the FXCM plugin is based (' the FXCM plugin uses an older and more stable version of the API') did not support OrderLimit. Another reason for a more common usable FIX plugin.

Re: OrderLimit support and behaviour [Re: Sphin] #471988
03/31/18 17:36
03/31/18 17:36
Joined: Dec 2013
Posts: 568
Fuerth, DE
Sphin Offline OP
User
Sphin  Offline OP
User

Joined: Dec 2013
Posts: 568
Fuerth, DE
At last I must agree to you, there should be really a better implemenation of limit orders at least if the API supported it anyway. As far as I read about MT4 there seem to be indeed no limit orders beside of pending orders until the price hit the limit and then change them to market orders but e.g. as you quoted the FXCM APIs can and I heard in MT5 real limit orders should also be possible.

Re: OrderLimit support and behaviour [Re: Sphin] #472040
04/03/18 08:18
04/03/18 08:18
Joined: Jul 2000
Posts: 27,986
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,986
Frankfurt
Except for MT4, most APIs normally support limit orders. They are normally implemented in new broker plugins and will be eventually also implemented in updates of older plugins.

Page 1 of 2 1 2

Moderated by  Petra 

Powered by UBB.threads™ PHP Forum Software 7.7.1