Convert to Trailing stop
Author: MikeyRules
Creation Date: 10/30/2008 5:37 AM
profile picture

MikeyRules

#1
Hello,

I am coding a system that starts with an initial worst-case stop, that I then want to convert to a trailing stop once an RSI value (RSI(2) > 80) has been hit.

In the code below, the trailing stop in effect as long as the RSI value stays above 80, but once it goes below it, the trailing stop disappears as it is no longer valid per the code.

What I would like to do is once the RSI value is hit, then the trailing stop becomes the only stop in effect. Any help or ideas with this would be appreciated! TIA.

CODE:
Please log in to see this code.
profile picture

Eugene

#2
CODE:
Please log in to see this code.
profile picture

Cone

#3
How about this?

CODE:
Please log in to see this code.
profile picture

MikeyRules

#4
Thanks for your responses. Eugene, I don't think your suggestion fixes the problem since when the RSI value goes below the slider value the trailing stop "disappears" and the only stop left is the worst-case one. But thank you for your help.

Cone, thank you, I think that will do it. I thought it might be a flag type of solution but couldn't come up with one that wouldn't reset. Yours looks great. Thanks again to both of you!

- Mark
This website uses cookies to improve your experience. We'll assume you're ok with that, but you can opt-out if you wish (Read more).