Gamestudio Links
Zorro Links
Newest Posts
Blobsculptor tools and objects download here
by NeoDumont. 03/28/24 03:01
Issue with Multi-Core WFO Training
by aliswee. 03/24/24 20:20
Why Zorro supports up to 72 cores?
by Edgar_Herrera. 03/23/24 21:41
Zorro Trader GPT
by TipmyPip. 03/06/24 09:27
VSCode instead of SED
by 3run. 03/01/24 19:06
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
2 registered members (AndrewAMD, Imhotep), 567 guests, and 4 spiders.
Key: Admin, Global Mod, Mod
Newest Members
sakolin, rajesh7827, juergen_wue, NITRO_FOREVER, jack0roses
19043 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Price of entry with OrderDelay #484359
10/14/21 12:17
10/14/21 12:17
Joined: Jul 2017
Posts: 783
Z
Zheka Offline OP
User
Zheka  Offline OP
User
Z

Joined: Jul 2017
Posts: 783
1) Using OrderDelay in Test, I have noticed that prices are different from those at the "timestamped" moments.

Say, with OrderDelay=59.9 and using M1 ticks, the timestamp of a trade is the first tick of a new bar (say, 8:01).

But the 'fill price' is different from that of a Close of 8:01 tick, or that of a 8:00 tick, and not by a spread or anything easily explainable.

So, Zorro must be doing some interpolation (though Slippage is set to 0).

Theoretically, such interpolations should make no material difference on a large sample of trades, BUT this is not what I am seeing.

On a sample of 23K+ trades across 11 currency pairs, entry prices with OrderDelay=59.9 are - on average - 0.4-0.6 pips BETTER than those at exact bar boundaries and even more so than at the next M1 tick.
This effect is quite similar for each pair.

So, how exactly does Zorro arrive at fill prices in the Test in this scenario and what would be the way to match it in Live?


2) Setting OrderDelay<60, leads to interpolations of prices somewhat closer to at exact bar boundaries; setting OrderDelay= 60-119.9 - closer to at the second M1 tick.

What would be the way to ensure that the fill price in Test is exactly at the 'close' of an M1 tick?

Not being able to do it is very inconvenient when reconciling Live vs Test for monitoring quality of execution.

Re: Price of entry with OrderDelay [Re: Zheka] #484370
10/16/21 00:03
10/16/21 00:03
Joined: Jul 2017
Posts: 783
Z
Zheka Offline OP
User
Zheka  Offline OP
User
Z

Joined: Jul 2017
Posts: 783
To support the above, this script
Code
int tmf() {
	
	if (TradeIsPending)
   	watch("#time=",tod(0), priceOpen(0), priceHigh(0), priceLow(0),priceClose(0));
	
	return 0;
}

function run() {
	NumYears=1;
	
	set(LOGFILE, TICKS);

	Verbose=3;
	
	Slippage=0;
	RollLong=RollShort=Spread=Commission=0;
	
	LifeTime=5;
	
	Entry=-3*PIP;
	
	OrderDelay=59.9; //119.9, 120.0
	
	if (NumOpenLong==0)
	 if (priceClose(0)>priceClose(20) ) 
		enterLong(tmf); 
}

produces this output at different OrderDelay:

[165: Wed 21-01-13 00:00c] -2.74 0 1/3 1.22061/1.22104\1.22025/1.22094 -0.0
Enter Long EUR/USD Entry -0.00030000 Delay 59.9 at 00:00:00
(EUR/USD::L) Long 1@1.22064 Entry limit
time= 0 1.22061 1.22104 1.22025 1.22094
time= 1 1.22094 1.22102 1.22094 .22102
[EUR/USD::L16602] Long 1@1.22094 x at 00:01:00

[151: Tue 21-01-12 10:00] 1.21527/1.21797\1.21509/1.21624 -0.0
Enter Long EUR/USD Entry -0.00030000 Delay 60.0 at 10:00:00
(EUR/USD::L) Long 1@1.21594 Entry limit
time= 1000 1.21527 1.21797 1.21509 1.21624
time= 1001 1.21624 1.21636 1.21614 1.21629
[EUR/USD::L15202] Long 1@1.21619 x at 10:01:00

[213: Fri 21-01-15 00:00c] -10.75 0 1/7 1.21532/1.21595\1.21507/1.21513 -0.00003
Enter Long EUR/USD Entry -0.00030000 Delay 118.9 at 00:00:00
(EUR/USD::L) Long 1@1.21483 Entry limit
time= 0 1.21532 1.21595 1.21507 1.21513
time= 1 1.21513 1.21518 1.21512 1.21515
time= 2 1.21513 1.21522 1.21512 1.21522
[EUR/USD::L21403] Long 1@1.21510 x at 00:02:00

[448: Fri 21-01-29 01:00c] -14.80 0 14/15 1.21216/1.21226\1.21043/1.21079 -0.0
Enter Long EUR/USD Entry -0.00030000 Delay 118.9 at 01:00:00
(EUR/USD::L) Long 1@1.21049 Entry limit
time= 100 1.21216 1.21226 1.21043 1.21079
time= 101 1.21079 1.21087 1.21070 1.21081
time= 102 1.21079 1.21091 1.21070 1.21081
[EUR/USD::L44905] Long 1@1.21075 x at 01:02:00

[1236: Wed 21-03-17 18:00c] 1.19022/1.19109\1.18983/1.19106 -0.0
Enter Long EUR/USD Entry -0.00030000 Delay 118.9 at 18:00:00
(EUR/USD::L) Long 1@1.19076 Entry limit
time= 1800 1.19022 1.19109 1.18983 1.19106
time= 1801 1.19106 1.19457 1.19106 1.19418
time= 1802 1.19106 1.19625 1.19106 1.19598
[EUR/USD::L23713] Long 1@ 1.19403 x at 18:02:00

[347: Fri 21-01-22 17:00c] -11.27 0 10/11 1.21727/1.21824\1.21711/1.21782 -0.0
Enter Long EUR/USD Entry -0.00030000 Delay 120.0 at 17:00:00
(EUR/USD::L) Long 1@1.21752 Entry limit
time= 1700 1.21727 1.21824 1.21711 1.21782
time= 1701 1.21782 1.21799 1.21782 1.21787
time= 1702 1.21782 1.21799 1.21778 1.21782
time= 1703 1.21782 1.21799 1.21773 1.21785
[EUR/USD::L34804] Long 1@1.21778 x at 17:03:00

[646: Wed 21-02-10 13:00] -13.81 0 21/26 1.21249/1.21250\1.21138/1.21173 -0.0
Enter Long EUR/USD Entry -0.00030000 Delay 120.0 at 13:00:00
(EUR/USD::L) Long 1@1.21143 Entry limit
time= 1300 1.21249 1.21250 1.21138 1.21173
time= 1301 1.21173 1.21189 1.21151 1.21158
time= 1302 1.21173 1.21189 1.21150 1.21169
time= 1303 1.21173 1.21189 1.21150 1.21173
[EUR/USD::L64707] Long 1@ 1.21162 x at 13:03:00


'Slippage' also works in some interesting ways:

//------------------if Slippage is not 0.--------------
[260: Tue 21-01-19 02:00] -14.97 +1.33 2/9 (1.20939)
time= 201 1.20939 1.20941 1.20936 1.20938
[EUR/USD::L25503] Expired 1@1.20942:[ +1.36 at 02:01:00 <---exit price is bigger than high of the tick??

[261: Tue 21-01-19 03:00] -13.61 0 2/9 (1.20953)
(EUR/USD::L) Long 1@1.20923 Entry limit
time= 300 1.20939 1.20987 1.20914 1.20953
time= 301 1.20953 1.20956 1.20931 1.20932
time= 302 1.20953 1.20956 1.20930 1.20935
[EUR/USD::L26203] Long 1@1.20928 x at 03:02:00 <---entry price is smaller than the lowest low of the first 2 ticks?


Last edited by Zheka; 10/18/21 23:49.
Re: Price of entry with OrderDelay [Re: Zheka] #484379
10/18/21 16:51
10/18/21 16:51
Joined: Jul 2017
Posts: 783
Z
Zheka Offline OP
User
Zheka  Offline OP
User
Z

Joined: Jul 2017
Posts: 783
Formatting does not seem to work:-( I cannot color-highlight or underline relevant prices...

Re: Price of entry with OrderDelay [Re: Zheka] #484380
10/18/21 17:31
10/18/21 17:31
Joined: Aug 2017
Posts: 294
Netherlands
G
Grant Offline
Member
Grant  Offline
Member
G

Joined: Aug 2017
Posts: 294
Netherlands
Unfortunately the color tab only works outside a code-tag

Re: Price of entry with OrderDelay [Re: Zheka] #484388
10/18/21 23:50
10/18/21 23:50
Joined: Jul 2017
Posts: 783
Z
Zheka Offline OP
User
Zheka  Offline OP
User
Z

Joined: Jul 2017
Posts: 783
Thank you! I modified the post above.

Re: Price of entry with OrderDelay [Re: Zheka] #484678
11/29/21 11:31
11/29/21 11:31
Joined: Jul 2017
Posts: 783
Z
Zheka Offline OP
User
Zheka  Offline OP
User
Z

Joined: Jul 2017
Posts: 783
@jcl,

Can you pls provide a feedback on the issue?

Re: Price of entry with OrderDelay [Re: Zheka] #484679
11/29/21 13:50
11/29/21 13:50
Joined: Apr 2008
Posts: 585
Austria
Petra Offline
Support
Petra  Offline
Support

Joined: Apr 2008
Posts: 585
Austria

Re: Price of entry with OrderDelay [Re: Zheka] #484680
11/29/21 18:09
11/29/21 18:09
Joined: Jul 2017
Posts: 783
Z
Zheka Offline OP
User
Zheka  Offline OP
User
Z

Joined: Jul 2017
Posts: 783
So, the applicable rule is:
Quote
Long OrderDelay. max of Entry and tick mid price.
It is obvious however in the first 2 of my examples that this rule isnt' followed:
Quote
[165: Wed 21-01-13 00:00c] -2.74 0 1/3 1.22061/1.22104\1.22025/1.22094 -0.0
Enter Long EUR/USD Entry -0.00030000 Delay 59.9 at 00:00:00
(EUR/USD::L) Long 1@1.22064 Entry limit
time= 0 1.22061 1.22104 1.22025 1.22094
time= 1 1.22094 1.22102 1.22094 .22102
[EUR/USD::L16602] Long 1@1.22094 x at 00:01:00

[151: Tue 21-01-12 10:00] 1.21527/1.21797\1.21509/1.21624 -0.0
Enter Long EUR/USD Entry -0.00030000 Delay 60.0 at 10:00:00
(EUR/USD::L) Long 1@1.21594 Entry limit
time= 1000 1.21527 1.21797 1.21509 1.21624
time= 1001 1.21624 1.21636 1.21614 1.21629
[EUR/USD::L15202] Long 1@1.21619 x at 10:01:00
However you calculate the mid-price - (O+H+L+C)/4 or (H+L+C)/3 or (H+L)/2 - the fill price is overly optimistic.

Last edited by Zheka; 11/29/21 18:15.
Re: Price of entry with OrderDelay [Re: Zheka] #484683
11/30/21 09:20
11/30/21 09:20
Joined: Apr 2008
Posts: 585
Austria
Petra Offline
Support
Petra  Offline
Support

Joined: Apr 2008
Posts: 585
Austria
Well I am not sure about the purpose of your code but would normally assume that the entry price is determined by the entry tick, not the last pending tick, and priceHigh is normally the high of a candle, not of a tick. You can see the highs and lows of the historical ticks with the History script.

https://manual.zorro-project.com/price.htm

Re: Price of entry with OrderDelay [Re: Zheka] #484685
11/30/21 09:56
11/30/21 09:56
Joined: Jul 2017
Posts: 783
Z
Zheka Offline OP
User
Zheka  Offline OP
User
Z

Joined: Jul 2017
Posts: 783
The script is several messages above; its a script to demo this specific behavior: fill price logic for OrderDelay+Entry.

Please clarify "entry price is determined by the entry tick, not the last pending tick"...What's the "entry tick" and what's the "last pending tick"?

PriceHigh/Low/Close of course cover a candle-so-far, and but are equal to those of a "historical" tick for the very first tick of a bar - which is the tick timestamped "..01" - that I refer to in 2 examples above.


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