Set Stop Loss Node

Set Stop Loss moves a trade leg's stop to a price your own logic computes, re-read on every tick. What to wire into it, the ratchet a trailing stop needs, and when a bracket is the better home for the same logic.

NodeBy AlgoLiftUpdated 3 min read
On this page 5How it worksExample: trail under the last two barsSettingsUse something else whenWhen it doesn't behave

A bracket's stop is fixed when the trade fills, and often that's exactly right. Sometimes it isn't: you want the stop tucked under the last two bars, or moved to breakeven once the trade has paid for itself. Set Stop Loss takes a price from your own logic and makes it the leg's stop, re-reading it on every tick.

Takes
A stop price
Gives
The leg's stop, moved to that price on every tick
Reach for it
A stop that moves by rules of your own, on a leg without a bracket

How it works

Drag Stop Loss off the setter rail at the bottom of a Trade node, and the new node is tied to that leg. A leg gets one, and only if it has no Bracket Order, which owns its stop.

What you wire in is a price, not a distance. "8 points under the entry" is the entry price minus 8: a Trade Variable reading Entry Price, into a Math Subtract with a Constant of 8.

The price is read on every tick, and the stop goes wherever it says, up or down. That's the part to respect. Wire in "price minus 10" and the stop slides down every time price pulls back. A trailing stop has to read the current stop back and keep the better of the two: Max of Current Stop and the new level for a long, Min for a short. The builder refuses a long whose stop comes from a Min (or a short's from a Max), because that's nearly always this mistake.

While the value has no number (an indicator still warming up, say), the stop stays where it was, so a trade that opens before the value exists has no stop until it does. The stop is also checked at the fill: a long whose stop would be at or above the fill price doesn't open, and the Entry tries again on the next tick.

A stop on its own isn't a complete leg, either. The builder also wants a Set Target Profit beside it, or a Set Exit Condition.

Example: trail under the last two bars

Say you trade ES 5m longs and like a stop that sits under the lowest low of the last two completed bars, climbing as the trade works and never dropping. Target 12 points.

Add a Price History set to Lowest, Low, 2 bars. Drag Current Stop off the Trade node, and wire both into a Math node set to Max, then the Max into Set Stop Loss. For the target, drag out Entry Price, add 12 with a Math Add, and wire that into a Set Target Profit.

On every tick the stop is the higher of where it already was and the two-bar low. Each new bar can lift it; a down bar can't lower it.

Settings

It has no settings. Which leg it sets is decided when you drag it off a Trade node.

Use something else when

A trailing or breakeven stop, ready-made
Trailing, Armed trailing, Breakeven and ATR trailing build this ratchet for you.
Your own stop logic on a leg with a bracket
Wire the same logic into the left edge of the bracket's stop row. The bracket's distance then protects the trade from the first tick, and your logic takes over from there.
Get out on a signal, not at a price
Closes the leg the moment a condition turns true, like a cross back through an average.

When it doesn't behave

My stop moves down on pullbacks

The new level goes straight into the stop with nothing to hold it. Put a Max (long) or Min (short) in front, with Current Stop on its other input.

My trades close right after they open, or never open

The price you wired is on the wrong side of the market. A long's stop above price is hit at once, and at the fill it refuses the entry altogether. Check what the value is when trades open, and remember it keeps moving: a level that crosses to the other side of price mid-trade stops you out the moment it does. For a stop at a level as it stood at entry, measure a Bracket Order's stop from a Level instead; that's read once, at the fill.

Or ask the copilot