// Définition des paramètres du code
DEFPARAM CumulateOrders = true // Cumul des positions désactivé
// Conditions pour ouvrir une position acheteuse
indicator1 = MACDline[12,26,9](close)
indicator2 = MACDSignal[12,26,9](close)
c1 = (indicator1 CROSSES OVER indicator2)
indicator3 = MACDline[12,26,9](close)
c2 = (indicator3 < 1.4)
IF c1 AND c2 THEN
BUY 10000+STRATEGYPROFIT CASH AT MARKET
ENDIF
// Conditions pour fermer une position acheteuse
indicator4 = MACDline[12,26,9](close)
indicator5 = MACDSignal[12,26,9](close)
c3 = (indicator4 CROSSES UNDER indicator5)
indicator6 = MACDline[12,26,9](close)
c4 = (indicator6 >= 3)
indicator7 = DonchianChannelDown[30]
c5 = (close CROSSES UNDER indicator7)
IF (c3 and c4) OR c5 THEN
SELL AT MARKET
ENDIF