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 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
ENDIF
IF 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
ENDIF
You have almost unreachable figures against PositionPerf.
PositionPerf is a %
POSITIONPERF
Consider 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
endif
The 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).
Ha did you spot the typo … 50/40000 = 0.00125 (not 0.000125 as above).
Thanks. It’s for dax and cac. And if i prefer in pips ? 🙂
If you prefer pips then you can’t use PositionPerf.
You could use …
IF longonmarket Then
If Close - TradePrice > 50*pipsize Then
SET STOP pTRAILING 8
If Close - TradePrice > 30*pipsize Then
SET STOP pTRAILING 10
If .... etc
endif
ENDIF
JSParticipant
Senior
Hi,
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
Positionprice * positionperf equals gain or loss in pips. So :
IF positionperf * positionprice > 30 THEN
SET STOP pTRAILING 10
endif