Backtest Lab Docs

Trade Entry Configuration

A Trade Entry action instructs Backtest Lab to place an order when the strategy enters the associated state.

Each trade entry requires four main settings: Asset, Action, Holding Period, and Order Type. Together, these determine what is being traded, the direction of the trade, how long it may remain open, and how the order is placed.

Asset

The asset specifies the type of financial instrument being traded.

Backtest Lab supports the following asset categories in its configuration:

  • Equity: Shares of publicly listed companies.
  • Futures: Contracts to buy or sell an underlying asset at a specified future date.
  • Options: Contracts that provide the right to buy or sell an underlying asset under specified conditions.

During the current beta, only Equity is supported. Futures and Options will be introduced in future updates.

Action

The action determines the direction of the trade.

  • Buy (Long): Buy shares with the expectation that their price will rise. A long trade generally makes a profit when the price increases.
  • Sell (Short): Sell shares with the expectation that their price will fall, intending to buy them back later at a lower price. A short trade generally makes a profit when the price decreases.

For example, buying a share at ₹100 and selling it at ₹110 produces a gross profit of ₹10 per share. Conversely, short-selling at ₹100 and buying back at ₹90 also produces a gross profit of ₹10 per share.

These examples exclude brokerage charges, taxes, and other trading costs.

Holding Period

The holding period determines whether a trade can remain open beyond the current trading day.

Intraday

An intraday trade is opened and closed within the same trading session.

For example, a trader might buy shares at 10:00 AM and sell them at 2:00 PM on the same day.

Intraday trading can involve both buying (long) and selling (short). Any position that remains open near the end of the trading session is automatically closed through a process known as square-off.

Delivery

A delivery trade can remain open across multiple trading sessions, allowing the trader to hold shares for days, weeks, months, or longer.

For example, a trader might buy shares on Monday and sell them several weeks later.

In Backtest Lab, delivery trades support long positions only. Short-selling is available only for intraday trades.

Order Type

The order type determines how the trade should be executed.

Market Order

A market order requests that a trade be executed at the next available market price.

For example, if a share is trading near ₹100 and you place a market buy order, the trade is executed at the available market price, which may be slightly higher or lower than ₹100.

Market orders prioritize execution rather than a specific price.

Limit Order

A limit order specifies a price at which you are willing to trade.

  • Limit Buy: Buy only at the specified limit price or lower.
  • Limit Sell: Sell only at the specified limit price or higher.

For example, if a share is trading at ₹105, you might place a limit buy order at ₹100. The order will only be fulfilled if the market reaches a price that satisfies your limit.

Unlike market orders, limit orders are not guaranteed to execute because the required price may never be reached.

In Backtest Lab, the limit price can be defined using a formula, allowing it to depend on market prices, indicators, or other values calculated by the strategy.

Limit orders also support an optional waiting period, after which unfulfilled orders are automatically cancelled. Learn more about Limit Order Expiry.

For more information about when orders become eligible for execution and how execution prices are determined, see Evaluation Timeline.