Trade Monitoring
As AlgoTest does backtesting on 1 minute :OHLC data. So In the backtest, some features like Individual Legwise SL/Target/TSL, etc. are calculated based on a High-Low of 1 minute. It aligns with LTP logic. Some features like RE-ASAP, RE-Momentum, Overall Settings, etc. are checked on :1-minute candle close.
To align with backtest logic we have given AlgoTest users the option to monitor their trades either on LTP or 1 minute Candle Close.
LTP​
LTP means Last Traded Price. Enabling this option means as soon as your strategy entry/exit condition is met, your trade will be executed. Selecting this feature allows the algorithm to execute all conditions in strategy on LTP.
Candle Close​
Here Candle Close means 1 minute candle close i.e. 59th second of every 1 minute. Selecting this feature allows the algorithm to execute some conditions on candle close and some on LTP. You can read all the features below on which Candle Close is implemented.
-
The strategy will check overall setting conditions on Candle Close
-
The strategy will trade Underlying SL, Tgt & Momentum on Candle Close
-
The strategy will execute legwise Re-ASAP & Re-Momentum on Candle Close
-
Strategy with Square off complete will square off all legs except the
trigger leg on Candle Close
Implemented Features on Candle Close in Detail
Features | LTP | Candle Close |
---|---|---|
Re-Entry ASAP & Re-ASAP Reverse | Say the SL/Tgt for a leg is hit at 10:02:25. Under the LTP feature, the Algo will immediately initiate your Re-ASAP condition. It will determine the strike based on your Strike selection criteria and take the new trade. | Say the SL/Tgt for a leg is hit at 10:02:25. Under the Candle Close feature, the Algo will wait till 10:02:59 to initiate your Re-ASAP condition. At 10:02:59, it shall determine the strike based on your Strike selection criteria and take the new trade. |
Re-Momentum & Re-Momentum Reverse | Say the SL/Tgt for a leg is hit at 10:02:25. Under the LTP feature, the Algo will immediately initiate the Re-momentum condition. It will determine the strike based on your Strike selection criteria and the Reference Price based on your Simple Momentum condition. | Say the SL/Tgt for a leg is hit at 10:02:25. Under the Candle Close feature, the Algo will wait till 10:02:59 to initiate your Re-ASAP condition. At 10:02:59, it shall determine the strike based on your Strike selection criteria and take the new trade. |
Re-Entry at Cost | Assume the 20 % SL (or Target) for a PE leg sold at Rs 100 is hit at 10:15:15. Under the LTP feature, the Algo will immediately initiate the Re-cost condition and place an advance order (Limit execution) to sell again at Rs 100. | Re-Cost works the same way for both LTP and Candle Close. |
Overall Settings | LTP | Candle Close |
---|---|---|
Strategy Level Overall SL, Overall Target | Strategy level Overall SL/Target conditions are checked continuously on an LTP basis. For example assume the overall SL for your strategy is MTM = Rs 5000. The strategy level loss reaches Rs 5000 at 12:20:10. The Algo will monitor your Overall conditions and square off your strategy immediately at 12:20:10. | Strategy level Overall SL/Target conditions are checked only on Candle Close. Assume the overall SL for your strategy is MTM = Rs 5000. At 12:20:10 the loss reaches Rs 5000 but reduces to Rs 4500 at 12:20:59. Under the candle close setting the Algo will check your overall SL condition on the 59th second of every minute/candle close. Since the loss at 12:20:59 was Rs 4500 which is less than your strategy level overall SL, it will not exit the strategy. This is how the backtest engine checks the Overall strategy condition. |
Overall TSL | Strategy Level Overall TSL conditions are updated and checked continuously on an LTP basis. For example assume the overall SL for your strategy is MTM = Rs 5000 and the associated TSL is Rs 100- Rs 100. The strategy initially made a profit of Rs 500 resulting in the overall TSL being updated to Rs 4500. Now the market reversed and the strategy went into a loss and at 12:20:10 the loss breached Rs 4500. The Algo will monitor your Overall conditions and square off your strategy immediately at 12:20:10. | Strategy level Overall TSL value is updated continuously but the TSL condition is checked on candle close. For example assume the overall SL for your strategy is MTM = Rs 5000 and the associated TSL is Rs 100- Rs 100. The strategy initially made a profit of Rs 500 resulting in the overall TSL being updated to Rs 4500. Now the market reversed and the strategy went into a loss. At 12:20:10 the loss breached Rs 4500 but was reduced to Rs 3500 at 12:20:59. Under the candle the close setting, the Algo will check your overall TSL condition on the 59th second of every minute/candle close. Since the loss at 12:20:59 was Rs 3500 which is less than your strategy level overall TSL, it will not exit the strategy. This is how the backtest engine checks the Overall strategy condition. |
Lock and Trail | Lock profit/Lock & Trail condition is checked continuously on an LTP basis and the exit trade is taken immediately. Assume your Lock Profit/ Lock and Trail value of Rs 3000 is breached at 12:20:05, the Algo will trigger the lock profit condition and square off all trades immediately at 12:20:05. | Lock profit/Lock and Trail condition is checked at candle close. Assume your Lock Profit/Lock and Trail value of Rs 3000 is breached at 12:20:05 but the profit increases to Rs 3500 by 12:20:59. Under the candle close setting, the Algo will check your Lock profit/Lock & Trail condition on the 59th second of every minute/candle close. Since the profit at 12:20:59 was Rs 3500 which is greater than your strategy level Lock profit value, it will not exit the strategy. |
SL/Target/Momentum Based on Underlying | LTP | Candle Close |
---|---|---|
Legwise SL on Underlying | Underlying SL is triggered and trade is taken as soon as the condition is met. | Underlying SL condition is checked on LTP but trade is taken at CANDLE CLOSE. For eg. the SL might be triggered at 9:30:35 but the trade will happen at 9:30:59. |
Legwise Target on Underlying | Underlying Target is triggered and trade is taken as soon as the condition is met. | Underlying Target condition is checked on LTP but trade is taken at CANDLE CLOSE. For eg. the Target might be triggered at 9:30:35 but the trade will happen at 9:30:59. |
Simple momentum on Underlying | Simple Momentum Underlying condition triggered and traded as soon as the condition is met. | Simple Momentum condition is checked on LTP but trade is taken at CANDLE CLOSE. For eg. the Momentum condition might be triggered at 9:30:35 but the trade will happen at 9:30:59. |
Re-Entry (All Kind) with SL/Target on Underlying | Re-entry trade is taken as soon as the Underlying SL/Target is triggered. | The underlying SL/Target condition is checked on LTP but exit trade is taken at CANDLE CLOSE. For eg. the SL/Target might be triggered at 9:30:35 but the trade will happen at 9:30:59. The Re-entry trade is entered immediately after the SL/Target trade has been taken. |
Iron Fly: 2 legs SL/Target based on Underlying, 2 Legs SL/Target based on points WITH SQUARE OFF COMPLETE | All the legs of the strategy are squared off as soon as any of the SL/Target conditions are triggered. | Condition 1: Underlying SL/Target for a leg is triggered: All the 4 legs will be executed on candle close.For eg. the underlying SL/Target for a leg might be triggered at 9:30:35 but all the legs will be squared off at 9:30:59. Condition 2: Leg with SL/Target based on points is triggered: Trigger leg will be exited instantly on LTP, while all the other legs (3 legs) in strategy will be executed on candle close. |
:To know more about how AlgoTest defines a candle, click here.
It is important to note that selecting Candle Close as monitoring doesn't mean all features will be on Candle Close. We have implemented Candle Close only for the features that are on Candle Close in backtesting.Â