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
5 registered members (Nymphodora, AndrewAMD, TipmyPip, Quad, Imhotep), 847 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
Unexpected entry prices with limit orders #485721
04/17/22 21:25
04/17/22 21:25
Joined: Aug 2017
Posts: 294
Netherlands
G
Grant Offline OP
Member
Grant  Offline OP
Member
G

Joined: Aug 2017
Posts: 294
Netherlands
I notice some unexpected entry execution prices when comparing 4 limit price variations for a long entry.

With a default slippage (so basically, no use of this setting), the following 2 entries:
Code
Trade = enterLong(1, priceLow());
Trade = enterLong(1, priceLow() - 0.0001)

(note that I disable one of them per test run)

return:
Quote
Execution Price for EUR/USD: 1.12098
Execution Price for USD/JPY: 108.72152
Execution Price for GBP/USD: 1.32219
Execution Price for AUD/USD: 0.70026
Execution Price for USD/CAD: 1.29863


and the following 2 entries:
Code
Trade = enterLong(1, priceHigh());
Trade = enterLong(1, priceHigh() + 0.0001);

(note that I disable one of them per test run)

return:
Quote
Execution Price for EUR/USD: 1.12090
Execution Price for USD/JPY: 108.71700
Execution Price for GBP/USD: 1.32201
Execution Price for AUD/USD: 0.70016
Execution Price for USD/CAD: 1.29851


Why is there no difference in execution price between these 2 variations? (i.e. both priceLow() variations and vice versa for priceHigh())
Why are the last 2 variations (i.e. priceHigh()...) executed at a lower price, compared to the 2 priceLow() variations? For a long entry this makes no sense to me.
When I adjust slippage to 0, all 4 limit variations return the same entry execution price. This also makes no sense to me.

Here's my full code

Code
TRADE* Trade;
var Time;

function run()
	{
	History = ".t6";
	BarPeriod = 1;
	StartDate = 20200101;
	LookBack  = 0;
	EntryTime = 1440;
	Slippage  = 0;
	set(LOGFILE);
	
	
	if(is(INITRUN))
		{
		asset("EUR/USD");
		asset("USD/JPY");
		asset("GBP/USD");
		asset("AUD/USD");
		asset("USD/CAD");		
		}
	
	if(Bar < 1)
		{
		return 0;	
		}	
	
	if(Bar >= 1)
		{
		while(asset(loop("EUR/USD", "USD/JPY", "GBP/USD", "AUD/USD", "USD/CAD")))	
			{	
			Time = timer();
			
		  //***Both pointers return the same execution price and are higher than the priceHigh() limits when slippage = default.***	
		  //printf("\npriceLow(): %.5f", priceLow());
		  //Trade = enterLong(1, priceLow());
		  //Trade = enterLong(1, priceLow() - 0.0001);
			
		  //***Both pointers return the same execution price and are lower than the priceLow() limits when slippage = default.***	
		  //printf("\npriceHigh(): %.5f", priceHigh());
		  //Trade = enterLong(1, priceHigh());
	        Trade = enterLong(1, priceHigh() + 0.0001);
			
			ThisTrade = Trade;
			
			Time = timer();
			
			for(last_trades)
				{
				if(TradeIsPending)
					{
					if(timer() - Time >= 1000)
						{
						printf("\n%s: Pending Order", Asset);	
						Time = timer();
						}
					}	
				printf("\nExecution Price for %s: %.5f", Asset, TradePriceOpen);
				}
			}
		quit();	
		}
	}

Re: Unexpected entry prices with limit orders [Re: Grant] #485736
04/18/22 16:38
04/18/22 16:38
Joined: Jul 2017
Posts: 783
Z
Zheka Offline
User
Zheka  Offline
User
Z

Joined: Jul 2017
Posts: 783
Because with the Entry argument>0 in enterLong(), you are entering on a stop, not on limit.

Re: Unexpected entry prices with limit orders [Re: Grant] #485738
04/18/22 17:01
04/18/22 17:01
Joined: Aug 2017
Posts: 294
Netherlands
G
Grant Offline OP
Member
Grant  Offline OP
Member
G

Joined: Aug 2017
Posts: 294
Netherlands
Thanks for the heads up sir.
Now I re-read the manual, saying
Quote
Entry Optional entry stop when > 0, entry limit when < 0 (overrides the global Entry).
. So let's say that the current price is 1.00001 and I want to enter at 1, then I need to place a limit order with
Code
Trade = enterLong(1, -1)
is that correct?

Re: Unexpected entry prices with limit orders [Re: Grant] #485739
04/18/22 17:13
04/18/22 17:13
Joined: Jul 2017
Posts: 783
Z
Zheka Offline
User
Zheka  Offline
User
Z

Joined: Jul 2017
Posts: 783
Yes. Why not try it?

Re: Unexpected entry prices with limit orders [Re: Zheka] #485740
04/18/22 17:17
04/18/22 17:17
Joined: Aug 2017
Posts: 294
Netherlands
G
Grant Offline OP
Member
Grant  Offline OP
Member
G

Joined: Aug 2017
Posts: 294
Netherlands
Because I'm at my work right now wink

Thanks for your help!


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