How to stop backtest from enter a trade after TP untill the next day?

Hi, In my strategy I filter positions with PositionScore and MaxOpenPositions. I enter trades only at the open. However when I setup profit target and it get's triggered intra day, Amibroker automatically picks next trade from the list imiidiatelly. How can I make Amibroker wait untill the next day before executing next order? ReEntryDelay seems to only prevent the same ticker reopening. I'll just add that I have delay of 1 set to all trades.

ami

Use "Re-entry delay" parameter in ApplyStop call.

Hi, but this will only apply to a single stock, however, I'm trying to achieve this at the portfolio level. As You can see on the picture above, Amibroker picks next stock in the rank but it introduce look ahead bias. PSX hit TP intraday but backtest open new trade (RJF) on the Open of the same bar, while it should be open on the next day.

From the ApplyStops documentation:

a) (if you want to have stops executed AFTER regular signals, so cash from stopped out positions is NOT available to enter trades the same day)
ActivateStopsImmediately turned ON

b) (if you want to have stops executed BEFORE regular signals, so cash from stopped out positions IS available to enter new trades the same day)
ActivateStopsImmediately turned OFF

You can control ActivateStopsImmediately with the SetOption() command.

2 Likes

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