What actually decides whether your strategy adds to a position
Correction (2026-08-12) — read this first. I wrote this post believing that a buy
condition staying true after a fill would keep re-entering unless you added a guard clause.
I checked it against the engine and that isn't how it works, so I'm correcting myself rather
than leaving it to spread.
Two things actually decide it, and neither is a line in your entry logic:
- Split buy count. At 1 — the default — the BUY block isn't evaluated at all while you
hold a position, so a condition that stays true can't stack anything. Above 1 the block
does run again, deliberately: adding to a position is what that setting is for.
- Where the check goes. If you want a condition that can't fire while positioned, it has
to be part of the condition itself, if EntryPrice == 0 and Price > Sma(60):. An elif
placed after the buy never runs, because the branch above it already matched. Mine looked
like a guard and was decoration.
The thing worth checking is the setting, not the DSL. What follows is the original post, kept
because the replies below are answering it.
---
Writing a buy strategy without a guard against re-entering while you're already positioned is the most common beginner mistake I see, and it doesn't announce itself.
What happens: your conditions stay true after you're filled, so the logic keeps wanting to buy. Depending on how the rest is wired you either stack size you never intended or you churn in and out on the same signal. Your backtest and your live results stop being comparable, which is worse than either being wrong.
The fix is one clause at the end of the entry block that says "if I'm already in, do nothing." Write it before you write anything clever.
FFiveMinFiona12 posts · 0 followers
+ Follow