TradeGrok.
Open backtester

Strategy rulebook.

What each preset actually does, which inputs it uses, and how to build your own rules. This describes the static demo's historical simulator, not live order execution.

Entry presets

Signals use completed one-minute candles. An entry can fill only at the next consecutive candle's open in the same session, subject to capital and risk limits. There is at most one entry per strategy per IST day.

Price breakout

Trigger: the previous eligible close was at or below your entry level, and the current close is strictly above it. Set an Entry level (INR).

For a level of INR 100, a move from 99 to 101 qualifies; a move from 101 to 102 does not. This needs a crossing, not merely a price already above the level. The previous-close reference resets each session.

Buy the dip

Trigger: the completed close is at or below your Entry level (INR). No crossover, rebound, RSI check or trend filter is required. A falling stock can qualify; use custom rules if you want confirmation.

Moving-average cross

Trigger: the fixed 5-sample simple moving average crosses above the fixed 12-sample simple moving average. Previously the 5-sample average was at or below the 12-sample average; now it is strictly above.

No price-level input is needed. It requires 13 eligible closes to compare the previous and current averages. Entry samples reset each session and are collected only while flat and eligible to look for an entry. Use custom SMA rules for different periods.

Swing breakout

Trigger: the same fixed-level upward crossing as Price breakout. Set an Entry level (INR). The target must be at least twice the stop distance: 2R.

The distinction is its wider suggested stop, longer lookback for the suggested level and longer default holding period for timed exits. It does not detect chart patterns, trail a stop or automatically recalculate the breakout level each day.

Custom rules

Trigger: your entry rule tree evaluates to true at a completed candle. Choose Strategy → Custom rules to reveal the editor. Start with the custom-rule guide below.

Exit presets

Choose an exit under Strategy options → Exit strategy. Protective stop loss and take profit remain active with every exit, including custom rules. Ordinary exit signals use the next consecutive same-session open; protective stops and targets can execute within the candle.

Stop loss / take profit

No additional exit rule. The stop is the filled entry price minus Stop (%); the target is that entry price plus Target (%), rounded to paise. There is no automatic daily close with this preset. Batch runs still liquidate positions at the end of the selected range.

Moving-average reversal

Trigger: the 5-sample simple moving average is strictly below the 12-sample average. Unlike the entry preset, this does not require a fresh crossing.

The exit buffer starts with the filled entry's candle open, then collects completed closes while holding, retaining up to 12 samples. It needs 12 samples before comparing averages and can continue across sessions. No extra input is required.

Support breakdown

Trigger: the completed close is at or below Exit support level (INR). This is a fixed price, not automatically detected or trailing support. The protective stop can exit first.

Maximum holding period

Exit at your Exit time (IST) on Exit on session. The entry session counts as session 1; weekends and exchange holidays do not count as holding sessions.

The starter setting is session 3, or session 5 for Swing breakout, at 15:00 IST. This demo currently uses the same deadline logic as Scheduled exit; the preset names do not imply different execution algorithms.

Scheduled exit

Exit at the selected time on the selected holding session. The starter setting is session 1 at 15:00 IST, making it the default same-day deadline option.

The deadline is checked when a candle completes: the 14:59 candle completes at 15:00, allowing an exit at the 15:00 open if that next candle exists. If entry occurs after the deadline, the position is checked at its next completed candle. A signal without a next same-session candle cannot fill immediately.

Time + performance

At the selected session/time deadline, compare the completed close with the filled entry price. Exit if the percentage gain is below Minimum gain (%). This comparison is price gain before fees, not net P/L.

Meeting or exceeding the threshold passes this check once for that position. It is not checked again if the price later falls back. Stop loss, take profit and end-of-range batch liquidation still apply.

Custom exit rules

Exit when your exit rule tree becomes true while holding. New exit rules start with Close crosses below SMA(20). You can use different periods or combine checks; they do not disable protective exits.

Inputs & stock-aware defaults

Starter values are editable heuristics, not optimized parameters or a prediction of returns. The note beneath the dataset selector identifies their price basis. Fixed entry/support levels stay fixed throughout a run.

Entry and support prices
Levels accept INR 1-1,000,000. With prior complete sessions, breakout uses the previous session high plus a buffer; dip uses the prior close minus half the estimated daily range; swing uses the highest high across up to 20 earlier observed sessions, retaining only complete sessions. The buffer is 0.1% of the reference price, with a minimum of INR 0.01.
Stop, target and R
Stop: 0.2-10%. Target: 0.2-30%. One R is the initial entry-to-stop distance before costs; a 1% stop and 2% target is 2R. Targets must be at least 1R, or 2R for Swing breakout. Suggested stops use the average daily true range from up to 14 earlier complete sessions as a percentage of the reference price, multiplied by 1.5 for swing, rounded up to 0.1% and bounded by the allowed range. Suggested targets start at 2R.
No earlier history
The first selected session's opening price is the fallback reference, with a labelled 1% baseline distance. Breakout starts 0.5% above it, dip 1% below and swing 1% above. Future highs, lows, closes and returns are not used to choose these defaults. Choosing a later start date can make earlier candles available for the estimates.
Support default
Uses the previous session low when it lies between the planned entry and protective stop. Otherwise it starts 75% of the stop distance below the planned entry. This makes the suggested support closer than the stop, rather than redundant below it.
Position budget
A cash allocation, not an instruction to spend the entire account. Defaults start near 10% of capital, adjusted to estimated whole shares and bounded by position/per-trade risk limits; one share may require a larger allocation. Minimum input is INR 100, capped by capital and the position limit. Actual fill prices and shared risk can reduce the quantity or block entry.
Timed exits
Holding sessions: whole numbers from 1 to 60. Time: 09:15-15:14 IST. Minimum gain: 0-30%, initially 1R for Time + performance. Suggested time is 15:00, bounded before a known short session's close.

Suggestions follow stock, preset and date changes. Manual edits and active settings from saved strategies are retained. Use suggested inputs resets preset fields for the current selection without destroying custom rules.

Custom rules

A condition compares two values. A group combines conditions or smaller groups. AND means every child must match; OR means at least one child must match. Parentheses and outlined group boundaries show which checks belong together.

Available values

Open, High, Low, Close
The current completed candle's prices in INR.
Volume
The current one-minute candle's volume, not the day's cumulative volume.
SMA and EMA
Moving averages of closes, with a period of 1-500 candles. New inputs start at 20. SMA is the simple average; EMA uses a weight of 2 / (period + 1), seeded from the first period's simple average.
RSI
Wilder-smoothed RSI of closes, on a 0-100 scale. The default period is 14; the initial calculation needs 14 price changes, or 15 candles. Starter fixed thresholds are 30 for entry and 70 for exit.
Time (IST)
The candle's start-minute timestamp in Indian Standard Time, evaluated only after that candle completes. Compare it with a Fixed value to get a time picker. It is not your computer's current clock.
Fixed value
A numeric threshold in the other operand's units: INR for prices, shares for volume, an RSI level, or an IST time. New price thresholds use the selected stock; volume suggestions use 1.5 times the baseline for above, or 0.5 times for below. The baseline is the prior complete session's average minute volume, or the first completed candle when no prior session exists.

Compare like units: for example, RSI with a fixed RSI level, not a rupee price. Custom indicators warm up from the selected simulation history and continue across sessions; they do not use future candles. A comparison involving an unwarmed indicator is false. Crosses also need a previous valid value.

Comparison operators

Is above / Is below
Strictly A > B / A < B now. Equality does not match. These can remain true for several candles.
Crosses above
Previously A <= B, now A > B. Both operands can change, such as two moving averages.
Crosses below
Previously A >= B, now A < B.

Built-in dip/support presets include equality; custom Is below does not. There are no separate equality, NOT or script-execution operators.

Build a nested entry rule

This is an editing example, not a recommended trade. The volume threshold is illustrative; replace it with a suitable value for your dataset.

Close > SMA(20)
AND
(
  RSI(14) crosses above 30
  OR
  Volume > 50000
)
  1. Select a stock, then Strategy → Custom rules.
  2. On the first condition, set When: Close, Condition: Is above, Compare with: SMA, Period: 20.
  3. At the outer Add to this group row, click Add nested group. Choose AND in the overlay.
  4. Inside that new group, change its first condition to RSI, period 14, Crosses above, Fixed value: 30.
  5. Use Add condition inside the nested group, not the outer group. Choose OR in the overlay. Set the new condition to Volume, Is above, Fixed value: 50000.
  6. Check Rule reads as: Close > SMA(20) AND (RSI(14) crosses above 30 OR Volume > 50000). The parentheses are essential: the price check must match, plus either check inside the group.
  7. Set your budget, stop and target, then run the backtest. Inspect the trade log and replay, not just the headline return.

Each addition asks AND or OR. If a group already contains A AND B and you add C using OR, the editor preserves the earlier relationship as (A AND B) OR C. To get A AND (B OR C), build the inner group explicitly as above. Cancel or Escape adds nothing.

Custom exits and limits

Choose Strategy options → Exit strategy → Custom exit rules for an independent exit tree. For example, combine Close crosses below SMA(20) with RSI(14) > 70 using OR. Entry and exit trees do not automatically mirror each other.

The editor allows a maximum tree depth of 5 and 64 total nodes, counting groups and conditions. Indicator periods must be whole numbers from 1 to 500; numeric constants must be finite and between 0 and 1,000,000,000,000. Use the live expression preview to check nesting before saving.

Execution & limits

These are the demo's current rules, not a claim that the strategy will be profitable. Historical results are not forecasts. Return to the backtester.