// Définition des paramètres du code
DEFPARAM CumulateOrders = False // Cumul des positions désactivé
// Annule tous les ordres en attente et ferme toutes les positions à 0:00, puis empêche toute création d'ordre avant l'heure "FLATBEFORE".
DEFPARAM FLATBEFORE = 090000
// Annule tous les ordres en attente et ferme toutes les positions à l'heure "FLATAFTER"
DEFPARAM FLATAFTER = 090000
// Empêche le système de placer de nouveaux ordres sur les jours de la semaine spécifiés
daysForbiddenEntry = OpenDayOfWeek = 6 OR OpenDayOfWeek = 0
// Conditions pour ouvrir une position acheteuse
ignored, ignored, ignored, ignored, ignored, ignored, indicator1, indicator2 = CALL "Trader Dynamic Index TDI2"[13, 34, 2, 7]
c1 = (indicator1 CROSSES OVER indicator2)
ignored, ignored, ignored, ignored, ignored, ignored, indicator3, ignored = CALL "Trader Dynamic Index TDI2"[13, 34, 2, 7]
c2 = (indicator3 <= 36)
indicator4, ignored, indicator5 = CALL Waves[1]
c3 = (indicator4 >= indicator5)
IF (c1 AND c2 AND c3) AND not daysForbiddenEntry THEN
BUY 1 CONTRACT AT MARKET
// Stops et objectifs ( plus bas des trois bougies)
stoploss = lowest [3](low)
// détection du croisement TDI + waves pour cloture positioon
if indicator1 crosses under indicator2 or indicator5 <=0 then
// fermeture position achat
SELL AT MARKET
ENDIF
// Conditions pour ouvrir une position en vente à découvert
ignored, ignored, ignored, ignored, ignored, ignored, indicator6, indicator7 = CALL "Trader Dynamic Index TDI2"[13, 34, 2, 7]
c4 = (indicator6 CROSSES UNDER indicator7)
ignored, ignored, ignored, ignored, ignored, ignored, indicator8, ignored = CALL "Trader Dynamic Index TDI2"[13, 34, 2, 7]
c5 = (indicator8 >= 64)
indicator9, ignored, indicator10 = CALL Waves[1]
c6 = (indicator9 <= indicator10)
IF (c4 AND c5 AND c6) AND not daysForbiddenEntry THEN
SELLSHORT 1 CONTRACT AT MARKET
// Stops et objectifs (plus haut des trois bougies)
stoploss = highest [3](high)
// détection du croisement TDI + wave pour cloture positioon
if indicator2 crosses under indicator1 or indicator5>=0 then
// fermeture position vendeuse
BUY AT MARKET
ENDIF