Backtests
...
Running a Backtest
Positions

Exit Conditions

Below a backtest position's Entry Conditions, you'll find fields for Exit Conditions, whether at profit, loss, or timed. Those fields are explained below.

All exit conditions are optional. If you have multiple exit conditions defined, the backtest will monitor all of them and exit when the first one is met.

Profit

Profit exit conditions will exit a trade when you reach a certain profit level.

Profit Target (Optional):

  • For credit positions (short puts, short strangles, short iron condors, etc.), this will exit your trade when the credit that you received at entry reduces by this Profit Target %. If you received $1 credit at entry, and your profit target is 80%, then the trade will close when the market value of your position reaches $0.20.
  • For debit positions (long puts, long strangles, long iron condors, etc.), this will exit your trade when the market value of your trade increases by this Profit Target %. If you paid $1 debit at entry, and your profit target is 100%, then your trade will close when the market value of your positions reaches $2. 100% profit target will exit at 2x debit paid, 200% profit target will exit at 3x debit paid, etc.

Delta (Optional):

  • For Credit Positions (short puts, short strangles, short iron condors, etc.), this will exit your trade when the delta value of your short strike is at or BELOW your configured delta profit value. If your trade has multiple short strikes (strangle, condor, butterfly), the entire trade will close if any of the short strikes hit your delta value.
  • For Debit Positions (long puts, long strangles, long iron condors, etc.), this will exit your trade when the delta value of your long strike is at or ABOVE your configured delta profit value. If your trade has multiple long strikes (strangle, condor, butterfly), the entire trade will close if any of the long strikes hit your delta value. Note, just because you are exiting at this delta does not mean that your trade is profitable!

Premium Target (Optional):

  • This will exit your position when the market value of the trade reaches a certain premium target or market value. For credit positions, this happens when the market value is at or below your Premium Target. For debit positions, this happens when the market value is at or above your Premium Target. Due to liquidity and slippage, the backtester will not always fill trades at exactly your premium target. Sometimes you'll fill above and sometimes below, but the average fill should be close to your target.

Loss

Loss exit conditions will exit a trade when you reach a certain loss level.

Stop Loss (Optional):

  • For Credit Positions (short puts, short strangles, short iron condors, etc.), this will exit your trade when the credit that you received at entry increases by this Stop Loss %. If you received $1 credit at entry, and your stop loss is 100%, then the trade will close when the market value of of your position reaches $2. A 100% stop loss is equivalent to stopping at 2x credit received at entry, 200% stop loss equal to 3x credit received, 300% stop loss equal to 4x credit received, etc.
  • For Debit Positions (long puts, long strangles, long iron condors, etc.), this will exit your trade when the debit that you paid at entry decreases by this Stop Loss %. If you paid $1 debit at entry, and your stop loss is 80%, then the trade will close when the market value of of your position reaches $0.20.

Delta (Optional):

  • For Credit Positions (short puts, short strangles, short iron condors, etc.), this will exit your trade when the delta value of your short strike is at or ABOVE your configured delta stop value. If your trade has multiple short strikes (strangle, condor, butterfly), the entire trade will close if any of the short strikes hit your delta stop.
  • For Debit Positions (long puts, long strangles, long iron condors, etc.), this will exit your trade when the delta value of your long strike is at or BELOW your configured delta stop value. If your trade has multiple long strikes (strangle, condor, butterfly), the entire trade will close if any of the long strikes hit your delta stop.

% ITM (Optional):

  • This will exit your trade when one of your strikes moves a certain percentage in-the-money (ITM)

Earliest & Latest Stop Time of Day (Optional):

  • If running one of the stops above (Stop Loss, Delta, % ITM), you can optionally restrict that to a certain time of day with these times of day. If specified, stops will not execute outside of those times of day.

Trailing Stop

Trailing stops will monitor the bot's profit and loss over time and exit if the profit percentage falls by your specified amount.

Profit % Trigger (Optional):

If you enter a value here, the trailing stop will only be activated if and when the position reaches the profit % trigger. The trailing stop is not enforced if the position never reaches the trigger. If this is left blank, the trailing stop is enforced as soon as the position enters.

Proft % Trail Amount:

This is the percentage of profit that the position must lose in order to stop out.

MA Crossover

If you'd like to close your position when two moving averages cross each other, you can do that here.

Document image


The above example will exit when the 5-minute EMA is 0.1% below the 40-minute EMA. For MA Crossover, you have a number of available Exponential Moving Averages (EMA) and Simple Moving Averages (SMA).

Simple Moving Averages (SMA)

SMAs all use days for the period. 200-day SMA represents the average closing price over the last 200 days. For the current day that the backtest is trading, the backtester will include the intraday underlying price for that day's price. If you are using the 200-day SMA, the average will come from the current intraday underlying price and the 199 daily closing prices before that.

SMAs use unadjusted prices, which can lead to false signals following stock splits.

Exponential Moving Averages (EMA)

EMAs all use minutes for the period. 50-minute EMA represents the average OHLC4 price over the last 50 minutes. OHLC4 is (open + high + low + close) / 4. The backtest will exit the position on the bar with OHLC4 that meets your criteria.

EMAs reset daily and do not include prices from the prior session. This means that your EMA is not complete until the number of minutes in the EMA length have occurred for the current session. If using a 50-minute EMA while only 5 minutes into the session, the EMA at that point in time will only reflect the average for the first 5 minutes, not 50 minutes.

MA Value

To exit a position when the underlying price is above or below a moving average, fill in the "Exit on MA Value" section.

Document image


The example above will exit when the underlying price is at least 0.1% below the 10-minute EMA. You have a number of available Exponential Moving Averages (EMA) and Simple Moving Averages (SMA) to choose from.

Simple Moving Averages (SMA)

SMAs all use days for the period. 200-day SMA represents the average closing price over the last 200 days. For the current day that the backtest is trading, the backtester will include the intraday underlying price for that day's price. If you are using the 200-day SMA, the average will come from the current intraday underlying price and the 199 daily closing prices before that.

SMAs use unadjusted prices, which can lead to false signals following stock splits.

Exponential Moving Averages (EMA)

EMAs all use minutes for the period. 50-minute EMA represents the average OHLC4 price over the last 50 minutes. OHLC4 is (open + high + low + close) / 4. The backtest will exit on the bar with OHLC4 that meets your criteria.

EMAs reset daily and do not include prices from the prior session. This means that your EMA is not complete until the number of minutes in the EMA length have occurred for the current session. If using a 50-minute EMA while only 5 minutes into the session, the EMA at that point in time will only reflect the average for the first 5 minutes, not 50 minutes.

Timed

Timed exit conditions will exit a trade at a certain time/days to expiration.

Days to Expiration (Optional):

  • Use this to exit your trade at a certain number of days to expiration. You can also specify Time of Day to exit so that the backtest knows when exactly on that day to close out the trade.