In gambling research, outcomes that come close to a win activate reward circuitry much like wins do and increase persistence, even though a near miss is simply a loss.
Trading is full of them. A stop taken by one tick before the move ran, a limit order that missed the fill by a cent, a target missed by a few points before reversal. Each produces the strong sense that you were nearly right, and that feeling reliably triggers re-entry at a worse price.
Treat near misses as ordinary losses in the record and give them a cool-down. The specific rule that helps most is a ban on re-entering the same idea within a set interval unless the setup re-forms on its own terms.
Related: dopamine-and-variable-rewards, cool-down-period, chasing, revenge-trading