How TP / SL / max-hold work
Three exit gates fire whichever comes first: take-profit, stop-loss, or a hard time limit. Conceptual primer — no formulas.
Take-profit (TP)
TP is an upside target. When the position is in profit by the strategy's per-coin TP percent (e.g. ETH long TP = +22% relative to entry price), the bot closes it. The order is placed as a Limit Maker on dYdX to get the rebate, but it falls back to taker on partial fills.
TP percentages are calibrated to the volatility of each coin in backtests. ETH gets a wider TP because its swings are larger and slower; SOL/BNB get tighter TPs on the short side because volatility spikes are more frequent.
Stop-loss (SL)
SL is a downside cap. If the position is down by the strategy's per-coin SL percent (e.g. ETH long SL = -10%), the bot closes it. Stops are placed as Stop-Market orders on-chain so they fire even if the bot itself is down at the moment of the trigger.
Stop fills are taker orders (0.05% fee) versus the maker rebate on TPs (0.02%). The strategy parameters bake this fee asymmetry in — every backtest treats the stop side as 0.05%.
Max-hold
Time-based exit. Regardless of P&L, the bot closes the position after a fixed number of hours (e.g. ETH long: 144h = 6 days). Stops the strategy from getting stuck in slow chop and forces capital recycling.
If max-hold and SL would fire at roughly the same moment, SL wins because it triggers on price (on-chain) while max-hold is a bot-side timer (off-chain logic, polled every 30s).
Management overlays
v6.4 + v7 add two soft exits on top of the hard gates: 'early-loss' closes if you're already meaningfully red after a short window (e.g. >5% down in 4 hours — the signal was wrong, don't ride it to the SL), and 'flat-exit' closes if the price hasn't moved meaningfully in either direction (e.g. ±1% after 12 hours — the regime changed, free up the slot).
These overlays were each tested in isolation and in combination in the backtest; both contribute to score improvement vs. running with TP/SL/MH only.