Gamestudio Links
Zorro Links
Newest Posts
Sam Foster Sound | Experienced Game Composer for Hire
by titanicpiano14. 03/20/23 17:51
Strange error messages in for-loops
by AndrewAMD. 03/20/23 16:21
How can convert mdl7 with UV's?
by l1ve10. 03/20/23 16:13
Asset list - Market Column
by MatPed. 03/20/23 08:44
working with Futures
by logomon. 03/18/23 23:21
AUM Magazine
Latest Screens
SHADOW (2014)
DEAD TASTE
Tactics of World War I
Hecknex World
Who's Online Now
6 registered members (AndrewAMD, paulk, titanicpiano14, l1ve10, YesNotes, Grant), 1,178 guests, and 3 spiders.
Key: Admin, Global Mod, Mod
Newest Members
YesNotes, DonQuijote, cokibor, stilrz, unatrader
18906 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Instant execution of limit orders in HFT mode. #487191
02/06/23 18:22
02/06/23 18:22
Joined: Apr 2016
Posts: 32
M
madpower2000 Offline OP
Newbie
madpower2000  Offline OP
Newbie
M

Joined: Apr 2016
Posts: 32
I stumbled upon 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.
Should I set up some additional system variables?

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:
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: Instant execution of limit orders in HFT mode. [Re: madpower2000] #487199
02/08/23 11:54
02/08/23 11:54
Joined: Aug 2017
Posts: 263
Netherlands
G
Grant Online
Member
Grant  Online
Member
G

Joined: Aug 2017
Posts: 263
Netherlands
Which broker connection are you using? Some don't support true limit orders, such as MT4/MT5.
Check the manual for details on your connection type.

Re: Instant execution of limit orders in HFT mode. [Re: Grant] #487216
02/11/23 15:27
02/11/23 15:27
Joined: Apr 2016
Posts: 32
M
madpower2000 Offline OP
Newbie
madpower2000  Offline OP
Newbie
M

Joined: Apr 2016
Posts: 32
I didn't use any brocker. This is backtest.

Re: Instant execution of limit orders in HFT mode. [Re: madpower2000] #487218
02/11/23 15:57
02/11/23 15:57
Joined: Aug 2017
Posts: 263
Netherlands
G
Grant Online
Member
Grant  Online
Member
G

Joined: Aug 2017
Posts: 263
Netherlands
I see.

I'm not sure if limit orders are supported when Fill is set on 8 (I've only seen code examples with market orders with this setting).
Maybe JCL or someone else can elaborate on this?

Re: Instant execution of limit orders in HFT mode. [Re: Grant] #487220
02/12/23 14:22
02/12/23 14:22
Joined: Apr 2016
Posts: 32
M
madpower2000 Offline OP
Newbie
madpower2000  Offline OP
Newbie
M

Joined: Apr 2016
Posts: 32
Yes, this is the essence of my question. Is it a bug or a feature?
Anyway any classic stock exchange order matching engine supports this functionality, I’m not talking here about forex kitchen.
Anyway, JCL, where are you? Only you know the answer! smile


Moderated by  Petra 

Powered by UBB.threads™ PHP Forum Software 7.7.1