Using “Runtime Variable” on list level? — Tradetron Community
← Community

Using “Runtime Variable” on list level?

Uncategorized 1,249 views

saamrocks

I have a list of of stocks and I want use the set Stop Loss and Take Profit based on previous candle for each stock in list.

Is it possible? How?

Tradetron Team Tradetron team

Not directly. Initialize Variables can’t be used in list-based strategies, and runtime variables are not kept per stock. For a list, use keywords that already work per stock.

Per-stock stop loss and target on a list

In each set’s Set Exit, compare each stock’s price with its own entry or candle:

  • Previous-candle stop: LTP(<list>) < Position(LOW(Symbol(<list>, '15m')), -1) exits a stock when it breaks the last closed candle’s low.
  • Fixed % from entry: use Traded Instrument (field price) to compare with that stock’s entry price.
  • Rupee P&L per stock: PNL Underlying in the Set Exit gives the P&L of that one stock and exits only it.

If you need values stored once per stock, write the logic in custom Python (it can set variables with SetVar): How to add custom Python code to Strategy | Tradetron Helpdesk

Test in Live Offline (a list can hold up to 20 stocks there). Keyword reference: Keyword Documentation — Tradetron

:sparkles: Answer written with AI from Tradetron docs (Oct 2026). Original replies are kept above. Spot something wrong? Reply below.