I had the idea of this little code, wishing to implement a strategy deviated from the famous “Turtle” strategy : a breakout above a last high on a certain period.
The code is very simple : we trade with the breakout of the 100 last days ; and so for the exit. Of course you can test with other parameters the value “100” days , but it seems to me profitable on most indices.
Indeed , this code is performing very well on the CAC40 (83.3 % success , profit factor of 9.7 !), The DAX30, the S&P500, even the NIKKEI, etc.
After weeks of very hard work, and with some other parameters, I did finally succeed to develop a very high-performance code on the Dax (5 times more profit than this code, with 2x less drawdown), which I use each day.
For now, I suggest you try this mini-code, which proves to be effective for long-term investment.
Defparam cumulateorders = false
n = 2
REM ACHAT
// Le + haut du jour dépasse le +haut des 100 jours précédents
ca1 = high > highest[100](high[1])
IF ca1 THEN
BUY n shares AT MARKET
ENDIF
REM SORTIE ACHAT
// Le + bas du jour dépasse le +bas des 100 jours précédents
ca2 = low < lowest[100](low[1])
IF ca2 THEN
SELL AT MARKET
ENDIF