I'm trying to backtest a daytrading strategy where my trades will be in the chronological order that they occur, so I'm using time as a priority. This part of the code seems to be working, but now the part of the code which exits the positions never seems to be executed. Any suggestions about what's wrong? Here's the code:
CODE:
Please log in to see this code.
Size:
Color:
QUOTE:
but now the part of the code which exits the positions never seems to be executed.
The reason is that your exit routine looks for an entry signal to contain either "Group1|" or "Group2|" in the SignalName property, while your actual signal name is the result of
GetTime(bar).ToString("0.00").
Size:
Color:
Simply rewrite the exit routine like this:
CODE:
Please log in to see this code.
Size:
Color:
Thanks, Eugene, for pointing out the obvious. Now the code works fine.
Size:
Color: