Hi All, After re-reading through the AB Manual, I found this comment with regard to Controlling Trade Price.
"During back-testing AmiBroker will check if the values you assigned to buyprice, sellprice, shortprice, coverprice fit into high-low range of given bar. If not, AmiBroker will adjust it to high price (if price array value is higher than high)..." I think this is what is causing me the problem!!! In my situation, if the High of the price bar which creates the sell signal is below the trailing stop line, then the sellprice becomes the high of that bar instead of the previous bar's of the Trailing Stop value. Is there anyway to override this???? --- In [email protected], "chorlton_c_hardy" <chorlton-c- [EMAIL PROTECTED]> wrote: > > 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 >
