Register
Tutorial

Configure Entry and Exit Rules in QuantPower

This tutorial sets up entry and exit rules in QuantPower, using an EMA crossover on Nifty futures: the entry conditions, the order, each exit type, and the checks to run before anything goes live. A second example then sets up an opening range breakout on Bank Nifty options, so you see the entry modes that option strategies use.

QuantPower Research · Updated 16 Nov 2026 · 17 min read

Entries and exits are where most strategy mistakes hide. A rule that enters on the wrong candle, a stop measured from the wrong price, or an exit time later than the market's own square-off can turn a sound idea into a losing one. Each step below says what the setting does, what it does not do, and how to check it. The rules are examples to learn the screens with, not advice on what to trade.

Before you start

  • A QuantPower account with a connected broker, so the rules read live prices. Without one, signals can run against your Forward-test account on last-close prices.
  • The rule written in one sentence. For example: "Buy one lot of Nifty futures when the 20-period EMA crosses above the 50-period EMA on 15-minute candles; stop at 0.5% below entry, target at 1% above, and exit if the averages cross back or at 3:15 pm."
  • Free tools first. The rule builder, the charts and the strategy builder cost nothing. A backtest costs 2 tokens after 10 free a week.

The rules in this tutorial

PartRule
InstrumentNifty futures, current month
Candles15 minutes
EntryEMA 20 crosses above EMA 50, on a closed candle
OrderBuy 1 lot, market, intraday
Stop-loss0.5% below the traded price
Target1% above the traded price
Rule exitEMA 20 crosses below EMA 50
Time exit15:15

Why entries and exits deserve the most care

A strategy is mostly its entries and exits. The idea behind it, such as "trade with the trend" or "sell premium when nothing happens", is only as good as the exact rule that turns it into orders. Two traders with the same idea and different exits can have opposite results.

Entries decide how often you trade and at what price. An entry that fires on every small wiggle trades too often and pays too much in charges; one that waits for too much confirmation enters late and leaves little room before the stop. Exits decide how much you lose when wrong and how much you keep when right. A stop that is too tight is hit by normal noise; one that is too wide lets a small loss become a large one. A target that is too close cuts winners short; none at all can let a winner turn back into a loss.

Writing the rule down exactly, then testing it, is how you find out which of these problems your rule has, before the market shows you.

How entries and exits work in QuantPower

QuantPower has two kinds of automated strategy, and each handles entries differently.

Signal algos watch a condition. The condition can be a price above or below a level, a day change in per cent, an indicator compared with a level or another indicator, or a full rule of up to 20 conditions in All and Any groups, using any chart indicator, candle pattern or chart formation, and indicators you wrote yourself with Arth Script. Conditions are checked on closed candles, from 1 minute to 1 week. When the condition is met, the signal either notifies you with the order ready (one-touch) or places the order itself (auto), and it can also start or stop an algo. The signal trading page covers signals in full.

Option bots hold legs with rules. Their entries are timed: at a set time, after a move of a set size (wait and trade), or on an opening range breakout. Their exits are rich: targets and stops on each leg and on the whole algo, trailing, stop to cost, re-entries and an exit time.

For an indicator entry with full exit management, the two work together: a signal watches the crossover and starts an Option bot, and the Option bot holds the position with its exits. Above both sit the account controls: Smart Exit, the daily loss limit and the kill switch.

Step 1: Choose the instrument and candles

  1. Open Algos → Signal algos and create a new signal.
  2. Search for Nifty futures and choose the current month's contract.
  3. Choose 15 minutes as the candle size.

Candle size changes what the rule sees. A crossover on 5-minute candles fires more often and reacts faster, with more false signals; on hourly candles it fires rarely and late. Pick the size your rule was designed for, and test others later. The futures contract matters too: near expiry, most trading moves to the next month's contract, and a rule left on the expiring contract sees thinner trading and wider spreads. Move the signal to the new contract a few days before expiry, or use the current-month contract each time you set the rule up.

Step 2: Add the entry conditions

  1. Add a condition: EMA (20) crosses above EMA (50).
  2. Leave it in an All group; a single condition needs nothing else.
  3. Optional filters, added to the same All group, narrow the entry. For example, RSI (14) is above 50 keeps only crossovers with some momentum behind them, and time is after 9:30 skips the noisy first minutes.

You can see each condition on the chart before you save it: add EMA 20 and EMA 50 to a 15-minute Nifty futures chart and look at where they crossed in the last few days. If the crossings you see are not the ones you meant to trade, change the rule now. Each condition is read on a closed candle. A crossover that appears halfway through a 15-minute candle and disappears before it closes does not count. This prevents the rule from acting on information that was not final, which is the most common way a backtest looks better than live trading.

Use Any groups for alternatives: "EMA 20 crosses above EMA 50" or "a bullish engulfing candle closes above EMA 50" in an Any group fires on either. Groups can be combined, up to 20 conditions in all.

Step 3: Set the order

The signal's order is what happens when the entry fires.

  1. Mode. Choose One-touch (the default): when the signal fires you get a notice and the order is ready, and you place it with one touch. Or choose Auto: after you arm it, the signal places the order itself, with every risk check. Any change to the condition or the order disarms an auto signal. Auto needs a connected broker, or your Forward-test account if you pick it.
  2. Action. For this rule, the signal starts an algo rather than placing a plain order, so the position gets full exits. Pick the Option bot you set up in step 4.

A signal can also place a single order directly: buy or sell, quantity, market or limit, and product. Use that when the exits will be handled another way, for example by a GTT with two legs, one above and one below, where the first to fire cancels the other.

Step 4: Set the exits

Set up an Option bot that holds one futures leg: Buy, Nifty futures, 1 lot, Intraday. Then set its exits.

Stop-loss and target on the leg

  1. Stop-loss: 0.5%, counted from the traded price.
  2. Target: 1%, counted from the traded price.

A stop and a target can also be set in points, in underlying points or per cent, or for options in a Greek. "Count from" can be the traded price, the price the entry was decided on, or the last price when the order was sent. The traded price is usually right, because it is what you actually paid.

Trailing stop

Trail SL: for every X the leg moves in your favour, the stop moves Y in your favour, and only ever tighter. For example, for every 0.2% gain the stop rises 0.1%. Choose whether it is checked on every pass or once every 1, 5, 15, 30 or 60 minutes. Our guide to the trailing stop loss explains how to choose X and Y.

Stop to cost

SL to cost moves the stop to the entry price once the leg is a set amount in profit, so a winning trade cannot turn into a loss on that leg.

What a hit does

On a hit: exit this leg only, or exit all legs. After a hit: re-enter the leg, or enter it on the opposite side, 1 to 20 times a day. For a single futures leg, a re-entry after a stop means the rule can try again on the same day; leave it off unless the rule was designed for it.

The rule exit

The exit on the opposite crossover is a second signal: EMA 20 crosses below EMA 50 on the same candles, set to stop the algo. Tested in a rule backtest, the same exit is one setting: turn on Exit on a rule too and add the condition.

The time exit

Set the Option bot's Exit time to 15:15. Every open leg is squared off at that time. The exit time is never later than the market's own square-off time for the contract.

Exits for the whole algo

For a multi-leg algo, exits can also sit on the whole position: an M2M target or stop in rupees or per cent, a net delta or theta band for options, and a lock-and-trail that protects part of a profit. For one futures leg, the leg's own stop and target do the same job.

All exits are market orders that only reduce the position; they can never open a new one. If an exit order is refused, it is retried up to 8 times with a growing gap, and the card shows what is still owed.

Choosing the stop and target distances

The example uses a 0.5% stop and a 1% target. Here is what those mean in rupees, and how to think about choosing your own.

With Nifty futures at 24,000, a 0.5% stop is 120 points and a 1% target is 240 points. One Nifty lot is 65 units, so the stop risks ₹7,800 and the target aims for ₹15,600, before charges. A round trip in Nifty futures costs a few hundred rupees in brokerage, STT, exchange charges and stamp duty at current rates; the site's brokerage calculator shows the figure for your broker.

Three ways traders set the distances:

  • A fixed percentage, as here. Simple, but the same percentage means more in a quiet week than in a volatile one.
  • A multiple of recent volatility, such as one or two times the average true range of the candles you trade. The stop then widens in volatile weeks and narrows in quiet ones. An ATR value can be read from the chart and written into the rule.
  • A chart level, such as below the last swing low. This fits discretionary reading but is harder to automate unless the level can be written as a condition.

Whichever you choose, check the ratio of target to stop against the win rate the backtest shows. A 1:2 stop-to-target needs to win about a third of the time, before costs, to break even; a 1:1 needs about half. The backtest tells you whether the rule does.

When several exits could fire

A position with a stop, a target, a trailing stop, a rule exit and a time exit has five ways to close. The first one reached closes it. In practice:

  • The stop and target are read continuously, or once per candle close if you chose that, from the traded price.
  • The trailing stop replaces the fixed stop once it has moved past it; it never moves back.
  • The rule exit fires on the closed candle where the opposite crossover appears.
  • The time exit fires at 15:15 whatever else is happening.
  • Above all of them, Smart Exit can square off every position in the account, the daily loss limit refuses new orders once reached, and the kill switch stops the segment until its next session.

The activity log on the algo card records which exit closed each trade, in one plain line, so you can see afterwards which one did the work.

How often exits are checked

In an Option bot you choose how often targets, stops, the lock-and-trail, wait-and-trade and breakouts are read: on every tick, or once per 1, 3, 5 or 15-minute candle close. Every tick reacts fastest but is more easily triggered by a brief spike. A candle close ignores spikes inside the candle but reacts later. The entry time, the exit time and exits already owed are never delayed by this setting. Test both in Forward test; the right choice depends on how fast the instrument moves and how wide your stop is.

Step 5: Read the summary

Before saving, read the rule back in plain words, as the app shows it: instrument, candles, entry conditions, order, stop, target, trailing, rule exit and time exit. Check five things:

  1. The candle size is the one you designed for.
  2. The conditions are in the right group, All or Any.
  3. The stop and target are counted from the price you mean.
  4. The time exit is before the market's close for the contract.
  5. The product is Intraday if the position must not be carried overnight.

Step 6: Save and test

  1. Save. A new algo is saved off; a signal in auto mode does nothing until armed.
  2. Backtest the rule. Open Backtest, choose Nifty futures and 15-minute candles, and write the same entry rule, stop, target and exit rule. Run it over up to 2,000 candles, about 80 trading days at 15 minutes. The tutorial on how to backtest a strategy walks through the report.
  3. Forward test. Run the signal and the algo against your Forward-test account for two or three weeks. Compare entries and exits with the backtest for the same days.
  4. Go live with one lot, once the Forward test matches the rule you meant. Set the daily loss limit and Smart Exit first.

Filters that help, and filters that hurt

A filter is an extra condition added to the entry to skip trades the rule should not take. A good filter has a reason that makes sense on its own: "only after 9:30, because the first minutes are noisy", or "only when RSI is above 50, because the rule is about momentum". A bad filter is one added because it improved the backtest, with no reason behind it.

The danger is overfitting. Every filter removes some trades. If you try ten filters and keep the one that removes most of the losing trades in the past, you have mostly learned which trades lost in that period, not which will lose next. Two habits help:

  1. Write the reason before you test the filter. If you cannot say why it should work, do not add it.
  2. Check the filter on days it was not tuned on. Run the backtest on a period you did not use while choosing it, and look at the unseen-days verdict. A filter that helps only on the tuning period is noise.

Fewer conditions usually generalise better. Most lasting rules have one entry idea and one or two filters at most.

Using your own indicators in rules

If the indicator your rule needs is not among the 201 on the chart, write it with Arth Script: 1 to 3 short formulas, one per line, using prices, moving averages, RSI, standard deviation, highest and lowest values, rate of change, ATR and plain arithmetic. Quanty can write it from a sentence, such as "the gap between the 9 and 21 EMA as a percentage of price", and you review it before it is saved. The server checks each formula with the chart's own code before saving, so what is saved always draws, and you can keep up to 50. A saved indicator then appears in the rule builder like any other, and works in signals, backtests and Forward tests.

Entries for option buyers and option sellers

The same screens serve both, but the settings that matter differ.

Option buyers lose to time decay when a move stalls, so their exits matter more than their entries. A stop on the premium, such as 25% to 35% of the price paid, limits the loss on a wrong call; a time-based exit, such as leaving after an hour if the target has not come, limits the cost of waiting; a cap on re-entries after a stop keeps a choppy day from becoming a string of small losses. Entries that wait for confirmation, such as a breakout, suit buyers, because the option needs the move to happen soon.

Option sellers collect time decay and lose on large moves, so their entries are usually at a set time and their exits sit on the whole position: an M2M stop in rupees, a stop on each short leg measured in underlying points, or a net delta band. Wings or a lazy hedge leg cap the worst case.

Entry modes for option strategies

Option bots have three entry modes.

ModeWhat it doesExample
At the timeEvery leg enters at the entry timeSell the at-the-money straddle at 9:20
Wait & tradeEach leg waits from the entry time until its premium or the underlying moves up or down by the points or per cent you set, then enters; each leg can have its own waitBuy a call only after Nifty rises 50 points from 9:30
ORBReads the high and low of the first N minutes (1 to 180) from the open or a time you set, on the underlying or the instrument, and enters on the first price above the high or below the lowBuy a call on a break above the first 15 minutes' high

Each leg's entry order can be market, limit with a buffer (pay up to the buffer to get filled, or wait for a better price), stop-limit for a breakout entry, or modify until filled, which moves an unfilled entry to the last price up to 10 times and then cancels it or sends it at market, as you choose.

A lazy leg does not enter with the algo. It enters when another leg enters, hits its target, or hits its stop, in chains up to 10 legs long. That is how an algo adds a hedge only after the main leg fills, or buys protection only after a stop is hit.

Second example: an opening range breakout on Bank Nifty

Rule: read the high and low of Bank Nifty's first 15 minutes; buy the at-the-money call on the first price above the high, or the at-the-money put on the first price below the low; stop-loss 25% of the premium; exit at 15:00.

  1. In Algos → Option bots, create an algo with two rule legs: buy call "ATM" and buy put "ATM", monthly expiry. Bank Nifty has a monthly expiry only since November 2024.
  2. Entry mode ORB, 15 minutes from the market open, read on the underlying. Set the call leg to enter above the high and the put leg below the low.
  3. Each leg: stop-loss 25% of its traded price, on a hit exit this leg only.
  4. Exit time 15:00. Product intraday.
  5. Backtest it as an option strategy, then run it in Forward test.

The opening range breakout strategy page explains the idea behind the rule and sets out its variations.

Two settings change this rule's character more than any other. The first is the range length: 15 minutes catches early moves but more false breaks; 30 or 60 minutes gives fewer, later signals. The second is what happens after a stop. With no re-entry, the algo trades at most one side a day. With "reverse" after a hit, a failed break above the high flips into a put, which suits days that whipsaw but adds orders and charges on days that do not. Backtest both before choosing.

Testing the exits, one by one

A backtest shows that exits fired; a Forward test shows that they fire the way you expect on live prices. During the Forward-test weeks, check each exit at least once:

  1. The stop. Find a trade that closed on its stop. Did it close near 0.5% below the traded price, and how far past it did the fill land?
  2. The target. Find one that closed on its target, and check the same.
  3. The trailing stop. Find a trade that moved in your favour and then turned. Did the stop follow, and did it close the trade where the trail said?
  4. The rule exit. Find a trade closed by the opposite crossover. Was it the candle you expected?
  5. The time exit. Check that nothing was left open after 15:15.

If an exit never came up in the Forward test, the strategy has not yet been tested for it. Keep it in Forward test longer, or test that exit on its own with a simpler rule.

A checklist before you go live

  • The rule in plain words matches the sentence you started with.
  • Conditions act on closed candles of the size you designed for.
  • Stop and target are counted from the traded price, and their rupee amounts are acceptable.
  • A time exit is set before the market's close for the contract.
  • Product is Intraday unless you mean to carry the position.
  • The backtest and the Forward test agree on entries and exits for the same days.
  • The daily loss limit and Smart Exit are set for the account.

Common problems

ProblemLikely causeFix
The signal never firesConditions in an All group that rarely agree, or the wrong candle sizeRead the summary; test each condition alone on the chart
It fires too oftenCandles too short, or no filterUse longer candles or add a filter condition
The backtest and the live entries differThe live entry waits for the candle to closeExpected: both act on closed candles; compare candle times
A stop fired at a worse priceExits are market orders in a fast moveAllow for slippage when you set the stop
The position stayed overnightProduct set to OvernightSet Intraday, or an exit time before the close
An auto signal stopped placing ordersThe condition or order was changed, which disarms itArm it again after the change

Next steps

  • Backtest the crossover over several candle sizes.
  • Add the account controls: daily loss limit, Smart Exit and the kill switch.
  • Set up the opening range breakout in Forward test.

Start with 500 free tokens

Connect your broker, build a strategy and test it on paper before a single live order goes out.

Frequently asked questions

Can I use Arth.live price alerts instead of builder conditions?

Yes. Alerts on free Arth.live charts can be linked straight to a webhook signal. Your own script or scanner can also call a webhook: create one in Algos → Webhooks, link it to your algo, and have your tool call its URL. An entry hit switches the linked algos on for today and enters now; an exit hit stops them and squares off.

Can one strategy both buy and sell?

Yes. An Option bot can hold buy and sell legs together, as in a spread, and a leg can reverse after a hit. For a futures rule that goes long on one crossover and short on the other, use two signals, each starting its own algo.

Why should rules act on closed candles?

Because a condition halfway through a candle can disappear before the candle closes. Acting only on closed candles means the live rule sees exactly what the backtest saw, and avoids trades on signals that never really happened.

This tutorial shows how to use the software. The rules and numbers are examples, not advice on what to trade. QuantPower is trading software, not a broker or an adviser. Trading involves substantial risk.