poolFreeze() and poolThaw() (for VHedging/NFA accounts)

Posted By: AndrewAMD

poolFreeze() and poolThaw() (for VHedging/NFA accounts) - 07/27/19 18:37

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.
Posted By: jcl

Re: poolFreeze() and poolThaw() (for VHedging/NFA accounts) - 07/29/19 08:17

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.
Posted By: AndrewAMD

Re: poolFreeze() and poolThaw() (for VHedging/NFA accounts) - 07/29/19 13:30

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?
Posted By: Zheka

Re: poolFreeze() and poolThaw() (for VHedging/NFA accounts) - 07/29/19 16:52

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.
Posted By: AndrewAMD

Re: poolFreeze() and poolThaw() (for VHedging/NFA accounts) - 07/29/19 17:16

Aha, I misread "intrabar" as "intraday". Now I understand. Thanks.
© 2024 lite-C Forums