Hi Ronak,
Init var keyword is used to set some variable and assign them a value for the strategy. The variables created using init var keyword can be accessed by get runtime keyword ( mostly used when strategy has custom python code)
Example: to set a variable with name “abc” and value as “5”
Max profit is a seperate keyword which can be used for trailing SL
This example will check if profit has reached more than Rs. 3000, it will start trailing from Rs. 2000 and will exit strategy when pnl drops by 1000 points from max pnl.
Thanks you @vikram.bajaj.
Trailing SL is what is exactly I am looking for. But example that you gave is still at strategy level, Right?
My goal is to have TSL at Set level.
Either using Init Var or Python code.
Do you have any suggestion? which would be easier (or even if it’s possible using Init Var)
Thanks!
Yes, given logic wil work at strategy level. Its not possible to apply set level TSL from condition builder.
It will require custom python code. Please share your TSL logic for sets here- http://questionnaire.tradetron.tech/
Quant team will get back with its cost and timeline.
Hi @vikram.bajaj,
Thank you for the above sample. Can you please throw some light on how to use “Set Runtime”? I have been trying to configure this but it looks like it is not possible to set a value to it. Some usage example around this keyword will be helpful.
Thanks.
True.
I don’t find any clear implementation of init var, get runtime, set runtime.
This are the master keys of every developer and I am struggling hard to get this implemented in strategy using Tradetron platform.
OR
Is it like, this is of no use in tradetron env. Mainly used in Python code. If so, then what could be the ideal use of such keywords.
Simply put, as traditional developer, I want to init var in start of the strategy, then I’ll set runtime this variable with some value in repair condition and then I’ll get runtime this variable to check for desired value.
How to achieve this simple thing? please someone help.
These are three ways to store a value and read it back later:
s1entry = Number(1).So the pattern you describe works: init it, change it in a repair’s runtime, and check it with Get Runtime Number in another condition. Example: Get Runtime Number(s1entry) == Number(1).
Things that catch people:
Max Profit is a separate keyword: the highest PnL reached in the current run. It is used for custom trailing stops. For a stop loss per leg or per set, Leg TSL / Leg SL trail in a Repair Once block now does this without Python. For strategy-wide trailing, use Universal Exit TSL inside Universal Exit.
Guide: Runtime Variables in Tradetron — Capture Once, Use Anywhere | Tradetron Helpdesk
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.