Hi all,
The idea of this code does not come from me, but I wanted to test it.
The results are certainly not that great, but look promising on many actions.
However, I am disappointed with the CAC40 , whereas the code provides more than respectable performance on many actions.
The screenshot shows : the CAC40 , Total, Natixis, Sanofi. I think there’s frankly way to improve it, even if I have not yet tried .
You can test it, improve it, and have fun with it.
Good weekend to all !
DEFPARAM CumulateOrders = False // Cumul des positions désactivé
n = 10000/close // I did set n = 2 for the CAC40
mmc = 6 // moyenne mobile courte
mml = 14 // moyenne mobile longue
// Conditions pour ouvrir une position acheteuse
indicator1 = Average[mmc](RSI[14](close))
indicator2 = Average[mml](RSI[14](close))
c1 = (indicator1 CROSSES UNDER indicator2)
IF c1 THEN
BUY n SHARES AT MARKET
ENDIF
// Conditions pour fermer une position acheteuse
c2 = (indicator1 CROSSES OVER indicator2)
IF c2 THEN
SELL AT MARKET
ENDIF
// Conditions pour ouvrir une position en vente à découvert
c3 = (indicator1 CROSSES OVER indicator2)
IF c3 THEN
SELLSHORT n SHARES AT MARKET
ENDIF
// Conditions pour fermer une position en vente à découvert
c4 = (indicator1 CROSSES UNDER indicator2)
IF c4 THEN
EXITSHORT AT MARKET
ENDIF
// Stops et objectifs
//set stop %loss 5