CashInOut
Strategy Elements
Description
Specifies deposits and/or withdarawals to/from the current equity of a strategy by formula
Input
Formula expression returning an amount in dollars
Notes
This formula is evaluated once per day at the beginning of the day, before any trading signals are processed.
The resulting amount is added to the equity of the strategy.
The formula should return a positive value for deposits or a negative value for withdrawals, or 0 on dates when neither occurs.
The simplest way to use this formula in a multi-strategy system is to give it its own strategy, as in the examples below.
To provide a list of specific dates and amounts, use CashList rather than CashInOut.
Unlike FeesInOut, CashInOut is NOT included in backtest stats such as the annual return, max drawdown, and daily net percent gain or loss.
Examples
Add $1,000 every month at the start of the month:
CashInOut: if(Month <> Month[1], 1000, 0)
Withdraw 40% of last year's net profit at the start of each year:
CashInOut: if(Year[-1] > Year, -0.4 * max(0, Combined(Sum, S.NetDlr, S.BPY))), 0)
See also the annual_taxes.rts example script.
|