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
poolFreeze() and poolThaw() (for VHedging/NFA accounts) #477780
07/27/19 18:37
07/27/19 18:37
Joined: Feb 2017
Posts: 1,718
Chicago
AndrewAMD Online OP
Serious User
AndrewAMD  Online OP
Serious User

Joined: Feb 2017
Posts: 1,718
Chicago
jcl,

It would be useful if the script writer can "freeze" and "unfreeze" the pools. Allow me to explain.

Suppose an NFA account with Hedge = 5 has a stock with five different virtual positions, long and short, but we want to change all of those positions at the same time but ultimately submit a single trade to the broker to adjust the position.

The solution would then be to "freeze" the pool, open and close all of those virtual trades, and then "thaw" the pool. Upon "thaw", Zorro finally submits the desired pool order.

Example:
* Five virtual trades for MSFT are open, with the respective positions +10 -100 +20 -30 and +60, and therefore the pool is at -40.
* User calls poolFreeze(). All pools are frozen.
* User closes the first three virtual positions. So the total virtual position is at +30, but the pool is stuck at -40.
* User calls poolThaw(). All pools are unfrozen. Therefore, the pool changes position with a single order, increasing position from -40 to +30.

Why would I want this? Three reasons:
* Less brokerage fees.
* Reach desired position sooner.
* In the US, it is illegal to day trade stocks with an account size less than $25,000 - violators get their accounts frozen for months unless they put in enough cash. To avoid the violation, it makes sense to minimize the number of orders placed for a given stock. This freeze-thaw method would help.

Last edited by AndrewAMD; 07/29/19 13:26. Reason: fixed a number
Re: poolFreeze() and poolThaw() (for VHedging/NFA accounts) [Re: AndrewAMD] #477790
07/29/19 08:17
07/29/19 08:17
Joined: Jul 2000
Posts: 27,977
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,977
Frankfurt
I believe that it's already working this way. Trades entered in the run function are pooled together and result in a single pool trade. Only when you trade intrabar, trades are not pooled because they happen at different times and thus must immediately trigger a pool trade.

Re: poolFreeze() and poolThaw() (for VHedging/NFA accounts) [Re: AndrewAMD] #477793
07/29/19 13:30
07/29/19 13:30
Joined: Feb 2017
Posts: 1,718
Chicago
AndrewAMD Online OP
Serious User
AndrewAMD  Online OP
Serious User

Joined: Feb 2017
Posts: 1,718
Chicago
If I understand what you are saying:
* In a BarPeriod=1440 system, the pool is adjusted at the end of the run() call.
* In a BarPeriod<1440 system, the pool is adjusted the instant a virtual trade is opened or closed.

Is this correct?

Last edited by AndrewAMD; 07/29/19 17:17. Reason: It is not correct.
Re: poolFreeze() and poolThaw() (for VHedging/NFA accounts) [Re: AndrewAMD] #477795
07/29/19 16:52
07/29/19 16:52
Joined: Jul 2017
Posts: 783
Z
Zheka Offline
User
Zheka  Offline
User
Z

Joined: Jul 2017
Posts: 783
Trades are 'pooled' at the end of the run() call (which is at each BarPeriod).
Only if your tick-based TMF triggers a trade intrabar, does a 'virtual' trade become a 'pool' trade immediately.

Re: poolFreeze() and poolThaw() (for VHedging/NFA accounts) [Re: AndrewAMD] #477797
07/29/19 17:16
07/29/19 17:16
Joined: Feb 2017
Posts: 1,718
Chicago
AndrewAMD Online OP
Serious User
AndrewAMD  Online OP
Serious User

Joined: Feb 2017
Posts: 1,718
Chicago
Aha, I misread "intrabar" as "intraday". Now I understand. Thanks.


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