Trailing Stop with steps
Forums › ProRealTime English forum › ProOrder support › Trailing Stop with steps
-
-
01/06/2026 at 12:21 PM #255000
Hi all,
I have two related questions about stop-loss and trailing stops in ProRealTime:
- Does ProRealTime have any plans to add “steps” to the default stop-loss and trailing stop features?
For example, a trailing stop that moves only after the price has moved a certain number of points (a step), so that every time it moves X points it steps up by X points. - In the meantime, does anyone know how to write ProRealTime code so that whenever there is an open position, the stop code is automatically applied to it — even if the position was opened manually?
I’ve tried using some example code from this website, but in that code a Buy/Sell command needs to be part of the code, which means that if I open a position manually, the trailing stop doesn’t apply.
What I want is something like this:
- A “trailing stop” with a 100-point step, but not constantly trailing — only one movement.
- In other words, as soon as the position is X points in profit (e.g., 100 points), the stop moves to break-even and then stays there.
So if the market moves 100 points in my favour, the stop automatically moves to break-even and then stays there (no further trailing).
If anyone has code for this — or knows how to implement it in ProRealTime — I’d really appreciate your help.
Thanks!
01/06/2026 at 12:32 PM #25500201/06/2026 at 12:34 PM #255003Credit / Thanks for below goes to @JS
123456789101112131415161718192021222324252627If longonmarket thenStopdistanceBreakeven = A154 //20NormalStop = A155 //60nb = barindex - tradeindexminprice = lowest[nb + 1](Low)maxprice = highest[nb + 1](High)If maxprice >= positionprice + StopdistanceBreakeven thensell at positionprice stopelsesell at POSITIONPRICE - NormalStop stopendifendifIf shortonmarket thenStopdistanceBreakeven = A176 //20NormalStop = A177 //60nb = barindex - tradeindexminprice = lowest[nb + 1](Low)maxprice = highest[nb + 1](High)If minprice <= positionprice - StopdistanceBreakeven thenexitshort at positionprice stopelseexitshort at positionprice + NormalStop stopendifendif2 users thanked author for this post.
01/06/2026 at 3:09 PM #255012Here you have another example:
12345678910111213141516171819202122232425262728293031323334353637383940// ===========================// Trail Stop steps// ===========================triggerDistance = 100if not onmarket thenMoveToBreakEven=0endif// Example entry conditionIF NOT ONMARKET AND close CROSSES OVER Average[20](close) THENBUY 1 CONTRACT AT MARKETstoploss = close-triggerDistance*pointsizenewStopLevel = close + (triggerDistance * pointsize)set stop price stoplossENDIF// Management of open positionIF LONGONMARKET THEN// Check if profit is greater or equal to trigger distanceIF close >= newStopLevel and MoveToBreakEven=0 THENMoveToBreakEven=1stoploss=positionprice //breakevennewStopLevel = newStopLevel+triggerDistance*pointsizeset stop price stoplossENDIFif close >= newStopLevel + (triggerDistance * pointsize) and MoveToBreakEven=1 thenstoploss = newStopLevelnewStopLevel = newStopLevel+triggerDistance*pointsizeset stop price stoplossendifENDIF// ===========================// Graphic// ===========================// Trailing Stop and Next Levelgraphonprice newStopLevel coloured(0, 0, 255) AS "NextLevel"graphonprice stoploss coloured(255, 0, 0) AS "Trail Stop"// Moving Averagegraphonprice Average[20](close) coloured(255, 165, 0) AS "SMA"2 users thanked author for this post.
01/07/2026 at 3:31 AM #255037Thanks, where should I copy this code? When I create a new startegy system with this code it says I need at least one instruction to enter the market.
I want to enter the market then change the native PRT stop loss to move by 100 points instead of 1 point. It is like IG platform trailing stop where you can set Step to 100
01/07/2026 at 4:39 AM #255038 - Does ProRealTime have any plans to add “steps” to the default stop-loss and trailing stop features?
-
AuthorPosts
Find exclusive trading pro-tools on