Subject should read:
Backtesting day trading strategies that are flat at end of day
How can a strategy be designed to exit all positions at the end of each trading day, as a Day Trader would normally do? Ideally, the strategy should avoid entering a position when the time is near market close time. Would this require programming, or can it be done by rules?
Size:
Color:
QUOTE:
How can a strategy be designed to exit all positions at the end of each trading day, as a Day Trader would normally do?
What a difference a search makes! ;)
End-of-day Exit conditionTo exit all positions, pass
Positions.AllPositions instead of
LastPosition.
Also a couple of examples in our Wiki:
ID Breakout SystemIntraday / Multi-Time Frame | Mixing intraday and daily dataQUOTE:
Ideally, the strategy should avoid entering a position when the time is near market close time.
You could the same WealthScript keyword to check that before making entry:
CODE:
Please log in to see this code.
Size:
Color: