Hello All (again....) I'm struggling to solve a coding problem with regard to exits and would very much welcome some advice.
I'm using a trailing stop and currently wait for price to fall below it to signal the exit to a long position. My code is: Sell = C < Ref(stop, -1); At the moment the sell price is defined as the open for the following period. I have not added any additional code for this so assume this is the default setting. However, what I actually want to do is to use the value of the trailing stop on the period BEFORE the exit was signalled. As this is a weekly system, my logic behind this is that I will set the exit price based on the trailing stop once a week in advance. As soon as this level is breached my position will be closed at this value (give or take some slippage). I accept that this idea could result in the price dipping below the trailing stop value and then rising again causing me to be stopped out of the trade prematurely, but I am willing to accept that risk. My question is how can I code this? I have tried a few ideas including SellPrice = Ref(stop, -1); but nothing seems to work. Any ideas??? Thanks in advance, Chorlton
