Trading Date Range Question

I'm trying to dynamically change the equity amount during a backtest based on a date. For example,

startdate = ParamDate( "Start date", "03-15-2021",0);
EquityAmt = IIf( DateTimeToStr(DateTime(), 1) <= startdate, 10000, 20000 );
SetOption( "InitialEquity", EquityAmt );                  

which is trying to set equity 10K on an before "03-15-2021" and 20K after.

I'm trying to simulate a "cash injection" into the system if that makes sense.

Does anybody know how to do this? Thanks...

InitialEquity field of SetOption sets initial equity of entire backtest.
You can not add cash via that setting.


To add cash at some element in array you would have to do that via CBT

See Cash property of backtester object

-> bo.Cash

There have been posted examples already.

1 Like

This topic was automatically closed 100 days after the last reply. New replies are no longer allowed.