Hi!
Is it possible to exclude a date interval from the backtest?
I want to exclude 3 weeks of the Corona baisse.
2020-02-21 -- 2020-03-16.
I know that I can use the "From-To dates" and run the backtest
twice, but if it is possible to exclude this dates in the code it would be better!
Best regards,
Leif Axelsson
Sweden
dt = DateTime();
dt1 = _DT("2020-02-21");
dt2 = _DT("2020-03-16");
NOT_corona = dt < dt1 OR dt > dt2;
Buy = NOT_corona /*AND other rules*/;
or
dt = DateTime();
dt1 = _DT("2020-02-21");
dt2 = _DT("2020-03-16");
dt_corona = dt >= dt1 AND dt <= dt2;
Buy = NOT dt_corona /*AND other rules*/;
3 Likes
Hi!
Thank You very much for Your help.
Worked perfect!
/Leif