Store days first candle high and low in runtime variable — Tradetron Community
← Community

Store days first candle high and low in runtime variable

General 0 views

Prathamesh Namdeo Jathar

store days first candle high and low in runtime variable

Ask TT AI

You can store the first candle's high and low in two Runtime Variables, but they only save when a condition block fires. That means you need a block that fires right after the first candle closes, then read the values back with Get Runtime.

How it works: Runtime Variables are written when a block's condition fires (Entry, Repair Once, Repair Continuous or Set Exit). Each one is saved after that condition's leg is taken.

Steps

  1. Open your strategy from My Strategies: Sign in - Tradetron

  2. In the condition block that should capture the values, add a Runtime Variable. Give it a name, for example FirstHigh.

  3. Click the FX button and set the value to the candle's High. Use candle position 0 for the current candle or −1 for the previous one.

  4. Add a second Runtime Variable, for example FirstLow, set the same way using Low. You can add as many variables as you need.

  5. To use the values later in the Condition or Position Builder, read them with the Get Runtime keyword. The recommended structure is:

    • Line 1: Get Runtime (check that it returns a valid value)
    • Line 2: Traded Instrument (check that the instrument is actually traded)
    • Line 3: the expression that uses both

    Don't check a bare Get Runtime == 0.

  6. To see the stored values, go to the Deployed page, click the deployment's three dots and choose Runtime Data.

Things to watch

  • What the sources don't cover: they don't explain how to make a block fire exactly when the day's first candle closes, or how to pick a specific candle by time. The exact time condition and candle settings for "first candle of the day" aren't covered. Check the keyword docs or ask in the chat on tradetron.tech.
  • Reading too early: if a variable is read before it has been written, it comes back empty (None), which can cause a backend error. Make sure the capture block has fired before any condition reads FirstHigh or FirstLow.
  • Daily reset: variables never reset on their own. A Universal Exit clears all runtime variables, and that's the intended end-of-day pattern for intraday. Otherwise, reset a variable by creating the same variable name in the exit's runtime-variable block and setting it to 0. If you skip this, yesterday's values can carry into today.
  • Multi-underlying strategies: Initialize Variables can't be used in a strategy that runs on a list of instruments. Use Python there.

Example

At the first point where your block fires after the first candle closes, it saves:

  • FirstHigh = High of candle −1
  • FirstLow = Low of candle −1

Your entry and exit conditions can then compare price against those saved values using Get Runtime.

Helpful links

If you'd like help building this logic, you can connect your AI to Tradetron via MCP to build and check it, or I can connect you to a live Tradetron support agent.

:sparkles: Answered by Ask TT (AI) from Tradetron’s docs. It can be wrong: check before you trade, and reply if something is off. Not investment advice.

Prathamesh Namdeo Jathar

i want to store 1hr candles high and low into runtime variable how can i do that?
suppose market opens at 9:15 and 1 hr candle closes at 10:15 so this 1hr candles high and low how can i capture?