Hello,
It is quite easy to take position on the S&P500 : it is bullish over most of the time.
Because of this, I had the idea to try some strategies, only LONG strategies.
Here is one that works well.
We take a BUY (only) trade if :
– The 50 simple moving average is greater than the 120 simple moving average (upward trend)
– We have a close lower than the lower Bollinger band, set to 29 periods
We CLOSE the trade as soon as we close upper than the lower Bollinger band.
We place a stop loss at 3%.
Some considerations :
Why 29 periods for the Bollinger Band ?
Simply because I have ‘suroptimized’ the backtest, to give the best gross gain. Actually, you can set it to 30 periods.
On the screenshot, the backtest was made without reinvesting the earnings, with a very correct profit factor (> 4).
Of course, you can set « REINV = 1 » to test it with reinvested earning, which leads us to a gross profit of 2549K.
You can change the leverage according to the drawdown.
The strategy is very simple, maybe too simple… and maybe “suroptimized”.
Maybe would you find a way to improve it ?
DEFPARAM CumulateOrders = False
// TAILLE DES POSITIONS
LEVIER = 4
REINV = 0
IF REINV = 0 THEN
n = LEVIER
ELSIF REINV = 1 THEN
capital = 100000 + strategyprofit
n = (capital / 100000) * levier
ENDIF
// ACHAT
ca1 = close < BollingerDown[29](close)
ca2 = average[50](close) > average[120](close)
IF ca1 and ca2 THEN
BUY n shares at market
ENDIF
IF close > BollingerDown[29](close) THEN
sell at market
ENDIF
set stop %loss 3