Gamestudio Links
Zorro Links
Newest Posts
folder management functions
by VoroneTZ. 04/17/24 06:52
lookback setting performance issue
by 7th_zorro. 04/16/24 03:08
zorro 64bit command line support
by 7th_zorro. 04/15/24 09:36
Zorro FIX plugin - Experimental
by flink. 04/14/24 07:48
Zorro FIX plugin - Experimental
by flink. 04/14/24 07:46
LPDIRECT3DCUBETEXTUR
E9

by Ayumi. 04/12/24 11:00
Sam Foster Sound | Experienced Game Composer for Hire
by titanicpiano14. 04/11/24 14:56
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
2 registered members (Quad, AndrewAMD), 410 guests, and 0 spiders.
Key: Admin, Global Mod, Mod
Newest Members
11honza11, ccorrea, sakolin, rajesh7827, juergen_wue
19045 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Oanda plugin stop loss doesn't work on shorts #463570
12/14/16 02:45
12/14/16 02:45
Joined: Nov 2016
Posts: 9
K
kap Offline OP
Newbie
kap  Offline OP
Newbie
K

Joined: Nov 2016
Posts: 9
I get errors such as the following when opening short trades on Oanda - these do not occur when opening long trades.

This issue only occurs when connected to Oanda, it does not occur during backtests.

I am setting the stop price by assigning a small value (i.e. 3*PIP) to "Stop" - note there is a limit entry price on all orders too so the trade is not opened at the stazrt of the bar.

Any ideas?

-K

(USD/CAD::S) Entry limit 1.31336 hit at 02:35:58
!Order: {
"code" : 33,
"message" : "Invalid stopLoss error: requested stopLoss is below price 1.3134",
"moreInfo" : "http://developer.oanda.com/docs/v1/troubleshooting/#errors"
}
(USD/CAD::S) Can't open 100000 @ 0.00000 at 02:35

Re: Oanda plugin stop loss doesn't work on shorts [Re: kap] #463571
12/14/16 07:57
12/14/16 07:57
Joined: Feb 2015
Posts: 652
Milano, Italy
M
MatPed Offline
User
MatPed  Offline
User
M

Joined: Feb 2015
Posts: 652
Milano, Italy
Probably 3 pips are below the spread at that moment. My 2 cents

Re: Oanda plugin stop loss doesn't work on shorts [Re: kap] #463583
12/15/16 00:24
12/15/16 00:24
Joined: Nov 2016
Posts: 9
K
kap Offline OP
Newbie
kap  Offline OP
Newbie
K

Joined: Nov 2016
Posts: 9
The stop price sent to the broker is farther away than the "real" stop (i.e. StopFactor defaults to 50%).

USD/CAD spread is about 2 pips, I only see this error on shorts but I do see it on other currencies.

Also Oanda provides both bid and ask in its feed so plugin has the realtime spread - it should adjust the spread correctly for long/short when calculating the stop price.

I've tried setting the stop price explictly (i.e. the full price, not an offset) and I still see this issue - in the meantime I've disabled btoker stops (i.e. set StopFactor = 0) which at least gets Zorro to place the trade.

Is there any way to get Zorro to dump the broker traffic? Although Oanda uses a straightforward REST/HTTP protocol as it's SSL encrypted I can't use network captures to debug the plugin.

-K

Re: Oanda plugin stop loss doesn't work on shorts [Re: kap] #463602
12/15/16 16:11
12/15/16 16:11
Joined: Feb 2014
Posts: 73
Montreal, Qc Canada
F
Finstratech Offline
Junior Member
Finstratech  Offline
Junior Member
F

Joined: Feb 2014
Posts: 73
Montreal, Qc Canada
Are you using the set(TICKS) flag? If not, try it.

Re: Oanda plugin stop loss doesn't work on shorts [Re: Finstratech] #463608
12/16/16 08:06
12/16/16 08:06
Joined: Jul 2000
Posts: 27,978
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,978
Frankfurt
If your stop distance is too low, increase it. The API can not fix it since the fill price of a trade is unknown beforehand. Quote differences of 3 pips or more are not uncommon.

Many brokers do not accept stop loss orders at a distance less than 10 pips anyway.

Re: Oanda plugin stop loss doesn't work on shorts [Re: jcl] #463630
12/18/16 14:42
12/18/16 14:42
Joined: Nov 2016
Posts: 9
K
kap Offline OP
Newbie
kap  Offline OP
Newbie
K

Joined: Nov 2016
Posts: 9
Oanda's normal stops can be placed 0.1 pips below(above) the bid(ask) price for longs(shorts). For Oanda's trailing stops, they have to be placed at least 5.0 pips away.

In this case, given the orders have an entry prices, at the time the order is sent to the broker the market price is different from when the order was submitted to Zorro - it is unclear to me what adjustments Zorro may be making to the prices.

Is it possible to dump the raw broker order message when the plugin sends it?
Or do I need to write a TMF to dump the TRADE struct to a file to trace this?

-K

Re: Oanda plugin stop loss doesn't work on shorts [Re: kap] #463644
12/19/16 15:19
12/19/16 15:19
Joined: Jul 2000
Posts: 27,978
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,978
Frankfurt
In the case of entry orders the stop loss is relative to the entry price, not to the price at order time. There is no mechanism to dump the raw message AFAIK.


Moderated by  Petra 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1