In [Test] mode, can I simply subtract from Capital over time to emulate various costs/withdrawals? (The manual says that Balance and Equity are calculated based on Capital and trade profit - this suggests that Balance and Equity are strictly outputs in Test mode.)
Example applications: * Assets with complicated commissions costs, especially IB assets. (Commissions set to zero in the asset list.) * Monthly fees, such as data fees. * Monthly balance withdrawals.
However, this below script did the job. The fee simulator is the incur_fee() function. Note that Zorro is being conservative in the simulation and assumes you lose at least one penny on a break-even trade.
The below script makes your money disappear. ( ͡° ͜ʖ ͡°)
Follow up: if you need to use Virtual Hedging, you will notice that the above method does not work. This is because if virtual trades are placed during run(), then pool trades are not placed until the end of run(). This means that if you enter long and exit long in the same run() call, no actual pool trade is placed.
Whereas if you place any trades outside of run(), pool trades are placed instantly. So the fix is to use call() to place the "fee" trades, like so: