changing trailing stop distance within code
Forums › ProRealTime English forum › ProOrder support › changing trailing stop distance within code
- This topic has 5 replies, 2 voices, and was last updated 4 years ago by
robertogozzi.
-
-
09/10/2020 at 2:26 PM #143874
Hi all,
Can any one help me with below?
The problem I have is that according to my set of rules which is coded for PRT I have an Stop Loss of 15 points and a Trailing Stop Loss of 23 points , but ( and this happened both yesterday and today) the trade was correctly entered but with a 23 point stop loss which did then trail as it was supposed to.
How can I code for Initial Stop Loss of 15 points with a Trailing Stop Loss of 23 points ?
I would like an initial fixed stop of 15 points that trails by 23 points eg after the trade is 8 points in profit then the stop would start to move. So 15 point stop, market moves in my favor by 8 points, stop then trails.
Thanks
09/10/2020 at 7:14 PM #143892You should set 8 as the starting point, not 23.
The trailing stop always starts reading prices from TRADEPRICE (entry price) and counts pips from then. When the number of pips you set is reached it starts trailing.
If you use one of the code snippets (Nicolas’ is likely to be the most used) it first sets your stop at break even, then increases your locked profits as price moves STEPSIZE pips in your favour.
09/11/2020 at 12:04 PM #143943thanks
I think the issue with stepsize is that the stop will only move when when the previous candle ends.
Where as the IG trailing stop works intracandle and moves every pip. so you capture the move within the time frame.
so perhaps looking from something like this
Enter trade if x parameters are met.
add STOP 15 points. STEPSIZE 8
Should market move 8 point and stop is moved (steps). Delete stop and enter IG trailing stop (which has step of 1)
09/11/2020 at 5:51 PM #143956Do not use the built-in SET STOP [p]TRAILING, since it has fixed STEPSIZE.
Most of users use Nicolas’code (lines 17-56) at https://www.prorealcode.com/blog/trading/complete-trailing-stop-code-function/.
Strategies are always executed at closing time (you can use MTF support as a workaround, as many do; just search the word MTF or MULTI TIME FRAME), so the trigger can be a bit late.
The exit is at the very new SL calculated, instead, because a pending order is placed to set it.
1 user thanked author for this post.
11/30/2020 at 12:40 PM #15221611/30/2020 at 2:47 PM #152229No, it’s the same as before as TRAILING STOP is concerned. I believe this feature has more to do with IG rather than PRT, like partial closure of positions. We truly hope IG make life easier for us.
Currently you can use code snippets to mimick built-in trailing stop.
New features can be found here https://www.prorealtime.com/en/new-features-ProRealTime-v11-1.
New instructions and keywords at https://www.prorealcode.com/topic/list-of-new-instructions-indicators-available-in-prt-version-11/.
-
AuthorPosts
Find exclusive trading pro-tools on