Stop trailing distance reduced
Forums › ProRealTime English forum › ProOrder support › Stop trailing distance reduced
- This topic has 9 replies, 4 voices, and was last updated 3 months ago by
XORANDNOT.
-
-
05/28/2024 at 1:21 PM #233151
Hello,
I use a 20 pips trailing stop. I want it to be reduce as gain is rising. But it stay at 20 pips. How can i fix it ? Thanks
// Trailing Stop Conditionnel
IF longonmarket THENIF positionperf > 50 THEN
SET STOP pTRAILING 8
endif
IF positionperf > 30 THEN
SET STOP pTRAILING 10
endif
if positionperf > 20 THEN
SET STOP pTRAILING 15
endif
SET STOP pTRAILING 20
ENDIFIF shortonmarket THEN
IF positionperf > 50 THEN
SET STOP pTRAILING 8
endif
IF positionperf > 30 THEN
SET STOP pTRAILING 10
endif
if positionperf > 20 THEN
SET STOP pTRAILING 15
endif
SET STOP pTRAILING 20
ENDIF05/28/2024 at 3:29 PM #233155You have almost unreachable figures against PositionPerf.
PositionPerf is a %
https://www.prorealcode.com/documentation/positionperf/
1 user thanked author for this post.
05/28/2024 at 3:55 PM #23315605/28/2024 at 4:13 PM #233158Consider 50 points gain … what is that as a % of instrument price?
So for DJI at 40000 … 50/40000 = 0.000125.
So – for DJI at 40,000, you need …
IF positionperf > 0.000125 THEN
SET STOP pTRAILING 8
endifThe Instruction I linked to above is incorrect when it says PositionPerf is a %.
PositionPerf is a ratio of Gain to Cost (which it does also says in the link).
05/28/2024 at 4:27 PM #23315905/28/2024 at 4:40 PM #23316005/28/2024 at 5:22 PM #23316205/28/2024 at 5:31 PM #233163You could use …
12345678IF longonmarket ThenIf Close - TradePrice > 50*pipsize ThenSET STOP pTRAILING 8If Close - TradePrice > 30*pipsize ThenSET STOP pTRAILING 10If .... etcendifENDIF1 user thanked author for this post.
05/28/2024 at 7:39 PM #233167Hi,
Also keep in mind that your code will be read from top to bottom and the last “Set Stop pTrailing” will “override” all previous ones… The effect of your original code is the same as this code:
If OnMarket then
Set Stop pTrailing 20
EndIf
1 user thanked author for this post.
05/29/2024 at 3:13 AM #233178 -
AuthorPosts
Find exclusive trading pro-tools on