Hi all,
I'm trying to find a way to do the following but I am stuck - any ideas?
I need to devise some code to backtest in my portfolio-level strategy (daily bars for many equity symbols at the same time):
if somecondition = true then
do not trade any of the symbols for the next 20 days
Thanks for any ideas!
moses
Portfolio backtester - instructions for all symbols
- JoshM
- Posts: 2195
- Joined: 20 May 2011
- Location: The Netherlands
- Has thanked: 1544 times
- Been thanked: 1565 times
- Contact:
Re: Portfolio backtester - instructions for all symbols
Perhaps something like this?I'm trying to find a way to do the following but I am stuck - any ideas?
I need to devise some code to backtest in my portfolio-level strategy (daily bars for many equity symbols at the same time):
if somecondition = true then
do not trade any of the symbols for the next 20 days
Thanks for any ideas!
Code: Select all
if (someCondition = True) and (daysPassed < 20) then
#return;
// Other strategy code here
- JoshM
- Posts: 2195
- Joined: 20 May 2011
- Location: The Netherlands
- Has thanked: 1544 times
- Been thanked: 1565 times
- Contact:
Re: Portfolio backtester - instructions for all symbols
Well, you asked for a way to not trade any of the symbols (which the #return keyword will do), not for a way to calculate the number of days passed. Also note that I said "something like this", meaning that my answer was not a copy-paste solution but would also require some thought on your part.Josh, I can't seem to find a reserved word 'daysPassed'..?
Help!?
Similarly, to calculate the number of days passed, you can code something like this:
Code: Select all
Variables:
dateOfEntry(0),
daysPassed(0);
dateOfEntry = ELDateToDateTime(EntryDate(1));
daysPassed = ELDateToDateTime(Date) - dateOfEntry;