Cann’t you use a ttrailingstop and a stoploss together?
Forums › ProRealTime English forum › ProOrder support › Cann’t you use a ttrailingstop and a stoploss together?
- This topic has 6 replies, 4 voices, and was last updated 7 months ago by DeathMetal.
-
-
05/20/2024 at 1:04 PM #232815
Hello,
I have noticed strange results after using a trailingstop and a stoploss together.
See picture, the trade is closed by the trailingstop instead by the stoploss.
System on DAX:
SET TARGET pPROFIT 61
SET STOP pLOSS 34
SET STOP PTRAILING 5505/20/2024 at 2:09 PM #23281905/20/2024 at 4:10 PM #232828Sorry, I don’t want to share the code, because I’ve put a lot of time and money into this to get as far as I have now.
The code of the stop loss etc. is below the programming instructions.I have often encountered it in other systems I have created that one of the two does not work.
05/20/2024 at 7:43 PM #232839Yes the lower / last instruction re a stop loss cancels any previous instruction re a stop loss.
pTrailing cancels / negates / renders ineffective pLoss as written below.
123SET TARGET pPROFIT 61SET STOP pLOSS 34SET STOP PTRAILING 551 user thanked author for this post.
05/21/2024 at 4:03 PM #232887Yes, is GraHal right. You can’t have two different kind of STOP LOSS, the last one always overrides any previous one.
1 user thanked author for this post.
05/21/2024 at 6:12 PM #232894This should do the trick….
trailingstop for long and short12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364///// trailingstop for long and short ////////////////////////////////////////////////////////////////////////////////////// Reset variablesIF NOT ONMARKET THENLaagsteKoers=1000000HoogsteKoers=0ENDIFonce UitstapOpTSL=15 // points to trail for longonce UitstapOpTSS=20 // points to trail for short////////////// LONG /////////////////////////////If LongOnMarket AND HoogsteKoers=0 THENOpeningsprijsL= closeHoogstekoers=openingsprijsLENDIF// Determine highest highIf LONGONMARKET THENDezeHigh= highIf DezeHigh > HoogsteKoers thenHoogstekoers=DezeHighENDIFENDIF//Sell trade if close< highest high- x points (UitstapOpTSL )IF (close < (Hoogstekoers - UitstapOpTSL)) and LONGONMARKET thenSELL AT MARKETENDIF///////////////// SHORT ////////////////////////////////////////////IF ShortOnMarket AND LaagsteKoers=1000000 THENOpeningsprijsS= closeLaagstekoers=openingsprijsSENDIFIF ShortOnMarket THENDezeLow= lowIf DezeLow < laagsteKoers thenLaagsteKoers=DezeLowendifENDIFIF (close > (Laagstekoers + UitstapOpTSS)) and SHORTONMARKET thenEXITSHORT AT MARKETendifSET TARGET pPROFIT 75SET STOP pLOSS 45/// Exit by trailingstop is at market, only use this on small timeframes!!05/21/2024 at 6:24 PM #232895BTW, points for trailingstops must be larger then your stoploss, this was only for test purposes.
-
AuthorPosts
Find exclusive trading pro-tools on