Max holding time exit
Marks bars where an open position has been held past its time limit, a cue to exit.
The indicator watches a position input that is empty when flat and filled while a trade is open. It notes the bar a position opens, then counts the bars since then at 60 seconds each. Once that count reaches max_seconds it returns True on every bar until the position closes, and it places no orders itself.
How to read it
- Markers show only while a position is open and has been held max_seconds or longer.
- Read the first marker as the time-out bar; later markers repeat on each bar the position stays open.
- No markers means flat, or still inside the time limit.
What it outputs
- Time limit reached
- True on each bar where an open position has been held for max_seconds or longer. Other bars draw nothing.
When it fires
When an open position reaches max_seconds of holding time. That bar is the time-out: the trade has run past the limit, so the strategy or trader is due to exit. Markers keep appearing on later bars until the position closes.
Settings
- max_seconds
- Holding time in seconds before the flag turns on, counted as bars times 60, so it is exact only on one-minute bars. Raising it lets trades run longer; lowering it flags them sooner, down to 1 second. Default 7200 is two hours.
Pitfalls
- It only flags. Nothing closes the position unless a strategy or trader acts on the marker.
- The Cython build treats a zero input as flat and keeps an old position open when the input goes empty, so it can disagree with the reference build.
- On the sample used to check this indicator, the position never closed, so the flag sat on for 99% of bars. Real hit rates depend on how long your positions last.