Recomended Structure for Get runtime, Traded instrument, Traded instrument name keyword.

Using Get Runtime and Traded Instrument Keywords Correctly in Conditional Logic

When building conditions in a strategy, it is important to structure keyword usage correctly so that runtime values and traded instruments are evaluated in the right order. This ensures accurate execution and prevents logical or calculation errors.

This document explains how and why to structure conditions using the Get Runtime and Traded Instrument keywords, along with a visual example.

Get Runtime and Traded Instrument Keywords Correctly in Conditional Logic

Objective of This Structure

The goal is to:

  1. First, confirm that Get Runtime has a valid output.
  2. Then, confirm that the Traded Instrument mentioned in the logic has already been traded.
  3. Only after both checks pass, evaluate the mathematical expression that uses values from Get Runtime and Traded Instrument together.

This avoids scenarios where:

  • A runtime value is referenced before it exists.
  • A traded instrument is used in calculations before an entry is placed.


Mandatory Structure (Top-Down Order)

Line 1 – Get Runtime

Always place the Get Runtime keyword on the first line of the condition group.

Why?

  • It ensures the runtime variable (for example, stoploss) has been generated.
  • If no runtime value exists, further calculations should not proceed.


Line 2 – Traded Instrument

Place the Traded Instrument keyword on the second line.

Why?

  • This confirms that the referenced instrument has already been traded.
  • Prevents logical errors where price or LTP is checked for a non-executed instrument.


Line 3 – Mathematical Expression

Only after the above two checks, add the mathematical condition.

This expression may contain:

  • Traded Instrument Name / LTP
  • Get Runtime value

Example logic:

  • Compare LTP of the traded instrument with a runtime value such as stoploss.


Best Practices

  • Always keep Get Runtime and Traded Instrument as standalone checks at the top of the group.
  • Do not directly start with mathematical expressions.
  • Ensure the same traded instrument referenced in the condition is the one already executed.
  • Use keywords exactly as shown in the UI, without modifying their naming or structure.


⚠️ Important Warning: Checking 0 Value with Get Runtime


✔ Correct approach:

  1. First, check Get Runtime as a standalone condition
  2. Then apply further logic only after confirming it has output

❌ Avoid:

  • Directly checking Get Runtime == 0

Avoid using this setup


Updated on: 11/01/2026

Was this article helpful?

Share your feedback

Cancel

Thank you!