Lowest Low as trailing stop executes late
Author: schranzi9
Creation Date: 11/4/2012 4:53 AM
profile picture

schranzi9

#1
Can you help me with this issue?

I will use lowest low for the last 7 candle as a trailing stop. It works good in the chart but the ExitAtTrailingStop close the order only if the conditions in the if() are correct which means some days to late and I produce a wrong backtest.

How can I bring the ExitAtTrailingStop out of this "if (Close[bar]>Close[bar-1] && Close[bar]>Open[bar] && Close[bar-1]>Open[bar-1])" condition that the Exit of the trade are close correctly at the LL7 and not inside the if....{ }?

Thanks for your help.

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

Eugene

#2
Not sure what the problem is. If the boolean condition is not required, comment it out. Or rephrase, please.
profile picture

schranzi9

#3
My problem is, that ExitAtTrailingStop only execute when the condition "if (Close[bar]>Close[bar-1] && Close[bar]>Open[bar] && Close[bar-1]>Open[bar-1])" is true. So in real trading the Exit of trailing stop was not execute because I had not "(Close[bar]>Close[bar-1] && Close[bar]>Open[bar] && Close[bar-1]>Open[bar-1])" after the LL was created.

For example in the last EUR.USD chart the LL6 was at 1,2943 on 2012/10/22 but the ExitAtTrailingStop was not execute on 2012/10/24 when the course was lower then 1.2943.

I hope this help.

Thanks for help.



profile picture

Eugene

#4
So why can't you simply comment that line out?

Or, if you need the chart annotation, just move the trailing stop outside?

profile picture

schranzi9

#5
I will use the chart annotation for the LL6 but the trailing stop outside? Is that possible?
profile picture

Eugene

#6
Of course.
CODE:
Please log in to see this code.
profile picture

schranzi9

#7
I use this before too but the problem is that now the ExitAtTrailingStop execute not at the same level as the LL7 chart annotation but rather before independent from the LL7 chart annotation. The solution should be that the LL7 chart annotation is the same level as teh ExitAtTrailingStop.

Thanks for your help.
profile picture

schranzi9

#8
I want to test bool TrailStop but it did not work.

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

Eugene

#9
QUOTE:
I want to test bool TrailStop but it did not work.

Probably because either it doesn't make sense or you couldn't sufficiently explain what you're after.

Please stop adding changes at random and describe in simple terms what are you trying to achieve. As what you have described previously does not ring a bell to me, absolutely. One moment you exclude the trailing stop, another moment you put it back with a boolean condition that is absolutely unneeded.
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).