Hello,
On Twitter, someone was manually backtesting CCI crosses under 100 with SMA200 increasing, on GLO (GL Events).
We were exchanging on the SL position, SMA200 vs SMA20.
I was thinking that BOLLINGERDOWN could be a good compromise, so decided to code this strategy, comparing the 3 SLs.
Assets: stocks
Period: Daily
Fees: 0.5% per order
Position: 1000EUR
DEFPARAM CumulateOrders=False
// Variables to optimize
CAPITALInit = 1000 // amount to invest
REINV = 0 // reinvest profits or not
strategy = 2 // SL BOLLINGERDOWN
RRR=1 // Risk Reward Ratio
IF REINV = 0 THEN
n = round((CapitalInit / close))
ELSIF REINV = 1 THEN
capital = (CAPITALinit + strategyprofit)
n = round((capital/close))
ENDIF
ma200 = Average[200]
c0 = Close>0.5
c1 = c0 and CCI[20] crosses under 100 and ma200>ma200[1]
IF strategy = 1 THEN // SL: MA20
sellprice = min(close*0.97,Average[20])
ELSIF strategy = 2 THEN // SL: Boll Inf
sellprice = min(close*0.97,BollingerDown[20])
ELSIF strategy = 3 THEN // SL: MA200
sellprice = min(close*0.97,Average[200])
ENDIF
// Buy order
if not LongOnMarket and c1 then
BUY n shares at market tomorrowopen
myStop = n*(close-sellprice)
SET STOP $LOSS myStop
SET TARGET $PROFIT RRR*myStop
ENDIF
PS: I don’t think similar subject exist. If yes, the post can be deleted of course
Mean reversion strategy on up trend. You could use any bounded oscillators: RSI, Stochastic, .. They are used to time the entries.
I believe the intent was more to detect a consolidation (though this signal may be too early).
Mean reversion would be to buy out of oversold zone with SMA20 (or any other criteria) as TP, no?
Anyway, I posted here in case someone request the code, so that it can be shared, modified with other entry signals for those who are not confident in programming such simple strategy based on an entry signal (the initial backtest was done manually on graph and in Excel..)
Plus if some members have ideas of improvements to share, this would be a win-win situation.
Hi. Thanks for sharing. Did u find any improvements ur self ?
Not yet. I’m developing a file in which I compare several “famous” entry signals returns (MACD+SMA200, Supertrend+SMA200 etc…)
This condition will be added to my file to compare with other strategies
Following the recent excitement around ExtraTrend in the French community, I copied the money management script of the video, with some alternatives.
The next step would be to combine entries and exits to create complex strategy with re-entries, break even levels, and partial profits.
However, I like the simple approach of having a clear signal, SL and TP, backtested as profitable in the long term, and here we go!
Okey. Will be intresting to folow ur results.
Have u checked out this thread?
Btw can u share the snippetcode of moneymanagement u refered to?