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, Nymphodora), 972 guests, and 8 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
Zorro: Instant execution of limit orders in HFT mode. #487217
02/11/23 15:31
02/11/23 15:31
Joined: Apr 2016
Posts: 38
madpower2000 Offline OP
Newbie
madpower2000  Offline OP
Newbie

Joined: Apr 2016
Posts: 38
I stumbled upon Zorro's strange behaviour of Instant execution of limit orders in HFT mode.
If I placed a limit order with the correct price, it was executed immediately, but it must be pending.
I can’t figure out why it happened. This is a bug or a feature ?

Log output:
Code
Load Demo.csv
[0] Demo 10:00:00.43200: Ask 990.00 => 990.00 989.00
[0] Demo 10:00:00.43200: Bid 980.00 => 990.00 10.00
>>[0] 990.000000:980.000000
Enter Long Demo  Entry -50.000 at 10:00:00
(Demo::L) Long 1@940.00 Entry limit
[Demo::L00002] Long 1@990.00  at 10:00:01
Com 0000  Mrg 10.00  Net 0
Units 10.0000  MTotal 0.00  MCost 10.0000 PCost 10.00000 Opn 0
[0] Demo 10:00:01.86400: Ask 980.00 => 980.00 10.00
[1] Demo 10:00:01.86400: Bid 970.00 => 980.00 10.00
>>[1] 980.000000:970.000000


Code to reproduce this issue:
Code
#define TIME_FORMAT	"%Y%m%d %H:%M:%S"

function main()
{
	seed(3);
	set(LOGFILE+PLOTNOW);
	Verbose = 7; 
	MaxBars = 50;
	BarPeriod = 0.1/60.;
	Outlier = 0;
	assetList("Demo.csv",0); // assetAdd("Demo",0,0,0,0,1,10,0,1,1,0,"Demo.HFT");

	Hedge = 2;
	Fill = 8;
	Slippage = 0;
	Lots = 1;
	
	var Quote = 1000.0;
	var TimeStamp =  wdatef(TIME_FORMAT,"20200101 10:00:00");
	int result;
	var BidPrice;
	while(Bar < MaxBars) 
	{
		TimeStamp += 0.000005;
		Quote += sign(random()) * 10;
		BidPrice = Quote - 10;
		result = priceQuote(TimeStamp, Quote); 
		if(!result) printf("\npriceQuote(AskPrice:%f) ERROR!", Quote);
		
		result = priceQuote(TimeStamp, -BidPrice); 
		if(!result) printf("\npriceQuote(BidPrice:%f) ERROR!", BidPrice);
 
		plot("Ask", AskPrice, LINE, RED);
		plot("Bid", BidPrice, LINE, BLUE);
		printf("\n>>[%i] %f:%f", Bar, AskPrice, BidPrice);
		
		if((NumPendingTotal+NumOpenTotal)==0)
		{
			Entry = -50;
			enterLong();
		}
	}
	exitLong(); exitShort();
}

Re: Zorro: Instant execution of limit orders in HFT mode. [Re: madpower2000] #487487
05/15/23 13:38
05/15/23 13:38
Joined: Jul 2000
Posts: 27,977
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,977
Frankfurt
This attempt is not only once, but twice doomed to fail. First, your script sends no limit order - for limit orders you need to set OrderLimit. But HFT simulation disables anyway all trade parameters and only enters directly at the most recent quote.


Moderated by  old_bill, Tobias 

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