I am looking for any research about optimal strategies for gradually building (scaling in) positions inside a trend as well as optimal gradual exit strategies on pullbacks/reversals to minimise possible losses.
Here is a collection of papers. The general idea is that the market has investor classes that share different expectations. When in bubble territory, many investors generally agree that assets are overpriced, but they still invest in expectation of more investors entering the market (the greater fools). There are also sophisticated investors who know assets are overpriced. If they act in tandem, then the bubble will collapse. In general no sophisticated investor is large enough to fight the irrational exuberance of a large number of retail investors and noise traders (generally speaking traders with "erroneous" beliefs that are following trends). Therefore from each sophisticated investor's perspective, there is synchronization risk in attacking the bubble.
A list of papers follows:
Harrison and Kreps of NYU, have written a paper called "Speculative market behavior in a stock market with heterogeneous expectations" where they create a model of a market with imperfect information, where different classes of investors have heterogeneous expectations. One of their results is that buy and hold is not profitable in their model's framework.
"Positive Feedback Investment Strategies and Destabilizing Rational Speculation", a paper by De Long et. al, proposes a model to analyze positive feedback (i.e. trend following) investors.
This is my favorite, and a good read. A 1720 case study of a bank/broker in Britain, that successfully rode the South Sea Company bubble. The paper is by Temin and Voth.
The way to do gradual position entry and exit is to use multiple trend following rules, each of which is responsible for managing a part of the available capital. Only if all the trading rules agree will 100% of the capital be deployed.
As a simple example, suppose you have three rules. The first rule is based on 10 day momentum; this rule produces a score of +1/3 if p>p (i.e. the price is up over the last 10 days) and -1/3 otherwise. The second rule is a 20 day momentum rule, with output 1/3 if 20 day momentum is positive, and -1/3 otherwise. The third rule is based on 40 day momentum, again 1/3 or -1/3 depending on the direction of prices the last 40 days. The overall stance is based on the sum of the three rules. So if 10, 20 and 40 day momentum is positive the overall score is 1/3+1/3+1/3 = 1 so you will be 100% long; if one rule is bullish and the other two are bearish you will have 1/3-1/3-1/3 = -1/3 so you will be 33% short.
Of course this can be generalized and expanded in various ways. It is a well known idea, but I can't recall in what paper I first read about it.