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
1 registered members (AndrewAMD), 945 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
is it possible to limit the filled volume of a trade? #487165
02/01/23 10:39
02/01/23 10:39
Joined: Jan 2023
Posts: 15
Q
qin Offline OP
Newbie
qin  Offline OP
Newbie
Q

Joined: Jan 2023
Posts: 15
In backtest mode, is it possible to limit the filled volume of a trade by a percentage of the next bar's volume?

Re: is it possible to limit the filled volume of a trade? [Re: qin] #487166
02/01/23 13:22
02/01/23 13:22
Joined: Aug 2017
Posts: 294
Netherlands
G
Grant Offline
Member
Grant  Offline
Member
G

Joined: Aug 2017
Posts: 294
Netherlands
Yes, by using marketVol(-1), + setting the PEEK flag, not using the LEAN flag and having a Zorro S licence, see https://zorro-project.com/manual/en/price.htm

Needless to say that this won't work in TRADEMODE, plus there's the risk of a margin call during high volumes.

Re: is it possible to limit the filled volume of a trade? [Re: qin] #487167
02/01/23 14:36
02/01/23 14:36
Joined: Jan 2023
Posts: 15
Q
qin Offline OP
Newbie
qin  Offline OP
Newbie
Q

Joined: Jan 2023
Posts: 15
Thank you very much. By default, with daily bars, order is filled right before the market closes. So, is it possible to limit the filled volume of a trade by a percentage of the current bar's volume?
For example, I enterLong(1000), the current bar's volume is 2000, I set a parameter 10%, means only 2000*10% = 200 can be filled by the end of this bar, this should be done by system automaticly.

Re: is it possible to limit the filled volume of a trade? [Re: qin] #487168
02/01/23 15:04
02/01/23 15:04
Joined: Aug 2017
Posts: 294
Netherlands
G
Grant Offline
Member
Grant  Offline
Member
G

Joined: Aug 2017
Posts: 294
Netherlands
Sure, by using something like this

Code
double PctVol = 0.1;

enterLong(round(marketVol() * PctVol));


Side note: personally I would never base my position size on the current volume. This can lead to enormous trade positions.

Re: is it possible to limit the filled volume of a trade? [Re: qin] #487173
02/02/23 07:16
02/02/23 07:16
Joined: Jan 2023
Posts: 15
Q
qin Offline OP
Newbie
qin  Offline OP
Newbie
Q

Joined: Jan 2023
Posts: 15
Very interesting. Let me make it clearer.
First, set Fill flag to 3, that means with daily bars, this mode simulates trading at the market open price of the next day.
We use daily bars.

In backtest mode, suppose I enterLong(1000) at current bar, it should be filled at next bar's open price. But the next bar's volume is 2000,
I think at most 10% can belong to me, so my order should be filled by 10%*2000=200 shares, the left 800 shares cannot be filled.
You suggest to peek, but in practice, you can't peek. I think this should be treated by zorro automaticly. I wonder if zorro can do this?

Re: is it possible to limit the filled volume of a trade? [Re: qin] #487174
02/02/23 07:59
02/02/23 07:59
Joined: Aug 2017
Posts: 294
Netherlands
G
Grant Offline
Member
Grant  Offline
Member
G

Joined: Aug 2017
Posts: 294
Netherlands
Ah, I thought you traded forex/crypto/futures, hence my remark about the potential high volumes.

Setting the PEEK mode is only needed when you use future price/volume data, not with current data like 'marketVol()'


Moderated by  Petra 

Powered by UBB.threads™ PHP Forum Software 7.7.1