Runtime Variables: capture a value once, use it anywhere — Tradetron Community
← Help Center

Runtime Variables: capture a value once, use it anywhere

Create a strategy 2 views

Runtime Variables let your strategy store a value when a condition fires and use it later, usually in an exit.

Example: you enter on a crossover and want the low of the entry candle as your stop loss.

You can set runtime variables in Entry, Repair and Set Exit blocks.

Set one up

In the Condition Builder, open Runtime Variable:

  1. Name the variable (for example, Low).
  2. Click FX to define its value.
  3. Use the Position keyword, choose Low, and pick the candle: 0 = current candle, -1 = previous candle.
  4. Choose the instrument and timeframe, then save.

The value is stored when that condition’s leg is taken. You can create as many variables as you need, for example High and Low, or indicator values like EMA or Supertrend.

Use it in an exit

Use the Get Runtime keyword. Example:

LTP of the instrument less than Get Runtime → Low

The strategy exits when price drops below the stored level.

Follow the recommended structure for Get Runtime / Traded Instrument, and don’t build a condition directly on Get Runtime == 0: recommended structure

Resetting

  • Variables are stored at strategy level and last until a Universal Exit, which clears them all.
  • To stop a value carrying into the next trade, set the variable again after your exit (for example, to zero).
  • In multi-set strategies, each set can keep its own variables.
  • Reading a variable before it has a value returns None and can cause an error. Make sure it is written first.

See the values on a live deployment

On the Deployed page, click the deployment’s three dots (⋮) and choose Runtime Data.

  • Traded in the current counter: you see live values for that counter.
  • Not traded yet in this counter: you see the last completed counter’s values.
  • Never traded: nothing is shown.

New to counters? Read What is a counter.

Video

Runtime Variables – Tradetron Condition Builder

Worked example: Use entry candle high and low with runtime variables

:sparkles: Edited with AI from the original Tradetron article, checked against current docs (Oct 2026). Spot something wrong? Tell us in the Community.

Still stuck? Ask the community

Tradetron अब हिन्दी में भी उपलब्ध है हिन्दी में देखें Continue in English