hi fellow Trons,
I have a basic request, I am looking to implement below logic in tradetron:
if( condition 1) counter++;
if(counter ==2 && condition1) then BUY or SELL;
Is it possible to implement this??
Thanks,
Farty
hi fellow Trons,
I have a basic request, I am looking to implement below logic in tradetron:
if( condition 1) counter++;
if(counter ==2 && condition1) then BUY or SELL;
Is it possible to implement this??
Thanks,
Farty
did you try to set variables and use it? is it not working? how many times condition 1 will met?
I tried set variable, but there is no option to increment the set variable(atleast i couldnt find in the documentation).
Condition 1 will occur multilple times, but the idea is to take the trade 3rd time it occurs.
Do you think there is a different way to implement the same logic?
Partly. You can increment a runtime variable, but runtime variables are written only after a leg is taken. So you can’t count “condition 1 was true” on its own unless a trade happens each time.
In a block’s Runtime Variables: counter = Get Runtime Number(counter) + Number(1), with counter set to Number(1) in Initialize Variables (start at 1, not 0).
Position(Sum(Cross(<series 1>, <series 2>), N), -1) >= Number(3) is true once the cross has happened 3 times in the last N candles.Get Runtime Number(counter) == Number(3).SetVar a flag; read it in the entry. Guide: How to add custom Python code to Strategy | Tradetron HelpdeskA Universal Exit clears runtime variables. Test 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.
Joins open 10 minutes before. You'll also see a Join button on your dashboard.
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.