> ## Knowledge Base Index
> Fetch the complete knowledge base index at: https://help.tradetron.tech/sitemap.xml
> Use this file to discover available pages before exploring further.
> Pure-Markdown content can be obtained by appending a '.md' suffix to the content URLs listed in the sitemap (without the trailing slash).

# Runtime Variables in Tradetron — Capture Once, Use Anywhere


${youtube}[How to Store & Use Dynamic Values in Trading Strategies | Tradetron Runtime Variables](qHiIFqbl7hU)

---
### The Problem It Solves
When you're building a strategy on Tradetron, there's a very common need that comes up — you want to **capture a specific value at the moment of entry** and then use it later in your exit logic.
A classic example: you enter a long trade on a crossover, and you want to use the **low of that exact entry candle** as your stop loss. Simple idea. But without a proper mechanism to store that value dynamically, it becomes surprisingly tricky to implement cleanly.
That's the gap Runtime Variables fill.
---
### What Are Runtime Variables?

Runtime Variables are a feature inside Tradetron's **Condition Builder** that let you:
1. **Capture a value** the moment your entry condition is triggered
2. **Store it** at the strategy level
3. **Reuse it** anywhere in your strategy — most commonly in your exit conditions
Think of them as dynamic memory for your strategy. Instead of hardcoding values, your strategy captures and remembers them on the fly, based on what's actually happening in the market at that moment.

| You can set runtime variables for Entry, Repairs, Set Exits

---
### Setting One Up

Inside the Condition Builder, you'll find the **Runtime Variable** option. Here's the basic flow:

* Give your variable a name (e.g., *Low*)
* Click the **FX button** to define what value it should store
* Use the **Position keyword**, select *Low*, and choose your candle reference
    * **0** = the current running candle
    * **-1** = the previous candle
* Select your instrument and timeframe, then save

The moment your entry fires, the variable is created and the value is locked in.
You can create **multiple variables** — for example, a *High* variable alongside a *Low* variable, or even variables storing indicator values like EMA or Supertrend. There's no hard limit; build as many as your strategy logic requires.
---

### Using It in Your Exit
Once the variable is stored, you can reference it anywhere in your exit conditions using the **Get Runtime** keyword.
For example:
* Take LTP of the instrument → *less than* → Get Runtime → *Low*
This compares the live price against the value that was captured at entry. The moment price drops below that stored level, the strategy exits. Clean, precise, and fully dynamic.
---

### Resetting Variables
This is an important detail people often miss.
Runtime Variables are stored **at the strategy level**, not just for a single trade. They persist across the cycle and remain active until a Universal Exit happens — unless you reset them manually.
If you don't want a variable carrying over into the next trade, **reset it after your exit** by creating the same variable again and assigning it a value of **zero**. This prevents stale values from accidentally influencing future conditions.
If you're working with multiple sets, you can define and reset variables independently for each set.
---

### Viewing Runtime Variables on a Live Deployment

Once your strategy is deployed, you can inspect the current value of your Runtime Variables directly:

* Go to your deployed strategy
* Click the **three dots** on the deployment
* You'll find the **Runtime Variable** option there

**When will you actually see data here?**

This depends on where your strategy currently is in its cycle.
* If your strategy is in **live entered mode** (meaning it has taken at least one trade in the current counter), you will see the **live, up-to-date values** for that running counter.
* If your strategy has **not yet taken a trade** in the current counter, the Runtime Variable section will show values from the **last completed counter** — not the current one.
* If the strategy has **never traded at all**, there will be nothing to display.

So in simple terms: the data you see always belongs to whichever counter has the most recent activity. If the current counter is active and has entered a trade, you'll see current data. If it hasn't entered yet, you're looking at history from the previous cycle.
> Not sure what a counter is? Read the*** [Tradetron guide on Counters](https://help.tradetron.tech/en/article/what-is-a-counter-1yfhcwe/) ***first — it'll make this much easier to understand.
---
### Why This Feature Matters
Before Runtime Variables, strategies that needed to reference entry-time values were either hardcoded (inflexible) or required workarounds. Now you can build strategies that:
* Use **candle-specific levels** as stop losses or targets
* Store and compare **indicator readings** from the moment of entry
* Work with **multi-set strategies** where each set tracks its own independent values
It brings a level of precision and dynamism to strategy building that was difficult to achieve cleanly before.
---

### Watch the Full Walkthrough
Reading about it is one thing — seeing it built step by step makes it click much faster. Watch the complete video tutorial here:
📺 [**Runtime Variables — Tradetron Condition Builder**](https://www.youtube.com/watch?v=qHiIFqbl7hU&list=PLbaK-IXrHgNIQmjN7iWTUA2C_p_m37bmi&index=1)
The video walks through a real example from scratch — setting up the variable, wiring it into the exit, and understanding the reset logic. Highly recommended before you start building.
