Breakout with pyramiding
Breakout with pyramiding: buy a new 50-day high in an uptrend, add to it on each new 20-day high (twice at most), and follow the trend with a trailing stop three ATRs below its high. Half the position is sold at a 15% gain, so a winner pays something even if the trend later fails. After an add, the stop and the partial target are measured from the average cost.
Strategies · pyramid_breakout.rvw
language 1
strategy "Breakout with pyramiding" {
universe members("SYN500")
enter long when close > highest(close, 50)[1] and close > sma(close, 200)
add when close > highest(close, 20)[1]
max adds 2
rank by roc(close, 50)
size 4% of equity, max 8 positions
max position 12%
scale out 50% at 15%
trail 3 x atr(20)
}
Functions it uses
Try it
File ▸ New Script from Example adds it to a project. The examples read the sample’s index label, SYN500, and market ETF, SYNSPY; when your data has neither, a sheet asks what to read instead, one of your index labels (or every stock and ETF) and a ticker, so the example runs on your data as it is.
Before you trust what it does on your data, see whether it’s luck: Is this result luck?