Trailing stop on lowest low
Forums › ProRealTime English forum › ProOrder support › Trailing stop on lowest low
- This topic has 8 replies, 4 voices, and was last updated 7 years ago by juanj.
-
-
02/24/2017 at 10:09 AM #26261
Hi. Wondering how to encode “lowest [5] (low)” trailing stop counting from the trade time only and returns and stays with the highest value “lowest [5] (low)” after we have trade. Trailing stop value never goes down after rising, displays only the last maximum value of “lowest [5] (low)” in the trade. Thanks
02/26/2017 at 12:07 PM #2639802/26/2017 at 12:17 PM #26403Yes. After the purchase, the walk up just not down. In order to be stopped in decline.
02/28/2017 at 12:08 PM #26669OK, here we go, this is a code snippet that should work (not tested, please do your own test in ProBacktest with GRAPH instruction):
1234567891011121314151617181920//launch a buy order if the buy condition is metif buycondition thenbuy 1 contract at marketll = lowest[5](low)stoploss = close-llset stop loss stoplossendif//make a pseudo trailing stop at each new highest lowest[5](low)if not onmarket thenll=0endifif lowest[5](low)>ll and ll>0 thenll=lowest[5](low)endifif longonmarket thenSELL AT ll STOPendif03/16/2017 at 10:41 PM #28816Hi, trying to get this code to work but it wont, any advice ?
12345678910111213141516171819202122IF c1 and c2 and c3 and NOT ONMARKET THENbuy positionsize CONTRACTS at high+2 stopll = lowest[5](low)stoploss = close-llset stop loss stoplossendif//make a pseudo trailing stop at each new highest lowest[5](low)if not onmarket thenll=0endifif lowest[5](low)>ll and ll>0 thenll=lowest[5](low)endifif longonmarket thenSELL AT ll STOPendifSET TARGET PPROFIT 4003/17/2017 at 8:55 AM #2884303/21/2017 at 10:40 PM #29366Got it working but not as i thought
Wanted the stop to be behind the entry price bar on the lowest low within x bars away, took away the trailing but dint work, code as follow
1234567891011121314151617IF c1 AND c2 and c3 AND NOT ONMARKET THENbuy positionsize CONTRACTS at high+2 stopENDIFll = lowest[x](low)stoploss = close-llset stop loss stoplossif longonmarket thenSELL AT ll STOPendifGRAPH ll as "my lowest low trailing stop level !"SET TARGET PPROFIT 5503/27/2017 at 2:41 PM #29994You should look at this blog article on how to make a stoploss with an indicator value.
The lowest low of X periods is the lower band of a Donchian Channel of X periods.
03/27/2017 at 3:09 PM #30003@Nicolas referring to the recent post at https://www.prorealcode.com/topic/trailing-stop-loss/ can you possibly assist us in coding a manual Trailing Stop that will work the same as the Set Stop pTrailing function. I have attempted to code it but it is unfortunately not working as I imagined it to work.
-
AuthorPosts
Find exclusive trading pro-tools on