To close a position a fixed number of minutes after entry, add an exit condition that compares the entry time with the current time.
Steps
- In the Strategy builder, open the exit condition of the set.
- Pick the Time Difference (T2-T1) keyword. It returns the minutes from Time 1 to Time 2.
- Set Time 1 to EntryTime (the time the strategy entered) and Time 2 to Time with exchange NSE (the current IST time).
- Choose greater than or equal to and enter the number of minutes, for example Number(30).
The condition reads like this:
Time Difference (T2-T1) (EntryTime, Time(‘NSE’)) >= 30
Good to know
- It works only within the same day. Times are in HHMM form.
- Before any entry, EntryTime has no value, so the condition does not fire. That is expected.
- Do not compare the result with “not equal to”; use greater than or equal to.
- Test in Live Offline before going live.
More on these keywords: Keyword Documentation — Tradetron
Edited with AI from the original Tradetron article, checked against current docs (Oct 2026). Spot something wrong? Tell us in the Community.