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?
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?
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.
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.
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.Position(Highest High Value(Cross(RSI(...), Number(40)), N), -1) == Number(1).rs_flag = Number(2) in that entry’s Runtime Variables; it is written right after the leg is taken.SetVar('rs_flag', 2); then read it in conditions. Guide: How to add custom Python code to Strategy | Tradetron HelpdeskTest in Live Offline. Keyword reference: Keyword Documentation — Tradetron
Answer written with AI from Tradetron docs (Oct 2026). Original replies are kept above. Spot something wrong? Reply below.
Request received. Pick a time now, or close this and we'll call you to set one up.
The calendar didn't load here. Open the booking page ↗
Booked. The calendar invite is on its way to your email.
Tradetron's AI assistant — pricing, brokers, strategies, anything.
AI can make mistakes. Consider checking important information.
How good was it?
We store the question and the answer with your report so the team can audit it.