Skip to main content

Candle Close Implementation on AlgoTest

Candle Close on Re-entries

Now you have the feature to INITIATE :Re-entry conditions on :Candle Close. They shall work as follows:

Re-ASAP on SL/Tgt

Let's assume 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 on SL/Tgt

Let's assume 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-Momentum condition.

At 10:02:59, it shall determine the strike based on your Strike selection criteria and the Reference Price based on your :Simple Momentum condition.

tip

You can find this option under Advance Execution Settings.

Implemented Features in Detail

warning

Candle close time (HH:mm:59) will be decided after trade reporting to backend.
That means it will be based on Report Time of Leg Exit (not trigger time).

FeatureLTPCandle Close
:Re-Entry ASAP & Re-ASAP ReverseSay 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 ReverseSay 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-Momentum condition. At 10:02:59, it shall determine the strike based on your Strike selection criteria and the Reference Price based on your Simple Momentum condition.
:Re-Entry at CostAssume 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 SettingsLTPCandle Close
:Strategy Level Overall SL, Overall TargetStrategy level Overall SL/Target conditions are checked continuously on a 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 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 TSLStrategy level Overall TSL conditions are updated and checked continuously on a 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 reduced to Rs 3500 at 12:20:59. Under the candle close setting, the Algo will check your overall TSL condition on 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 TrailLock profit/Lock & Trail condition is checked continuously on 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 UnderlyingLTPCandle Close
:Legwise SL on UnderlyingUnderlying 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 UnderlyingUnderlying 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 UnderlyingSimple 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 UnderlyingRe-entry trade is taken as soon as the Underlying SL/Target is triggered.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 COMPLETEAll 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 other legs (3 legs) will exit on Candle Close (except the leg whose SL or Target has been hit).
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: All the 4 legs of this strategy will be exited on LTP or as soon as the point based SL/Target is triggered.

Update

In backtest if a candle includes both stop loss and target, then we chall consider it as follows : 

  • If the open price is closer to the high then high is given the priority.

  • If the open price is closer to the low, then low is given the priority.

:For any queries reach out to us!