RSI Flag when RSI crosses any value — Tradetron Community
← Community

RSI Flag when RSI crosses any value

Uncategorized 1,084 views

Dharam

Im initializing a variable , suppose ‘rs_flag’ as 1 at the start. Now whenever RSI cross 40 from below, want to change the ‘rs_flag’ value to 2, which I will be using it in set conditions. Anybody help me in this?

Manish

I think in condition you can check like if rsi> 60, buy position. here in runtime variable you can set variable rs_flag =2. do you want use that flag in next condition then you can use it.

Tradetron Team Tradetron team

Runtime variables are written only after a leg is taken in that block. So you can’t flip rs_flag from 1 to 2 when RSI crosses 40 unless a trade happens at that moment.

Options

  1. Use the RSI cross directly in your conditions (often simplest): Position(Cross(RSI(CLOSE(Symbol(<inst>, '5m')), 14), Number(40)), -1) == Number(1). Cross is 1 only on the candle where RSI crosses above 40.
  2. “RSI crossed 40 at some point in the last N candles”: Position(Highest High Value(Cross(RSI(...), Number(40)), N), -1) == Number(1).
  3. Flag set on a trade: if the cross is also your entry, add rs_flag = Number(2) in that entry’s Runtime Variables; it is written right after the leg is taken.
  4. Flag without a trade: use custom Python and SetVar('rs_flag', 2); then read it in conditions. Guide: How to add custom Python code to Strategy | Tradetron Helpdesk

Test in Live Offline. 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.