// Définition des paramètres du code
DEFPARAM Preloadbars = 20000
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 = 070000
// Annule tous les ordres en attente et ferme toutes les positions à l'heure "FLATAFTER"
DEFPARAM FLATAFTER = 200000
// Empêche le système de placer de nouveaux ordres sur les jours de la semaine spécifiés
daysForbiddenEntry = OpenDayOfWeek = 5 OR OpenDayOfWeek = 6 OR OpenDayOfWeek = 0
// condition pour ouvrir une position acheteuse
ignored, indicator1, ignored, ignored, ignored = CALL "Ichimoku perso"
ignored, ignored, ignored, indicator2, ignored = CALL "Ichimoku perso"
c1 = (indicator1 > indicator2)
ignored, indicator3, ignored, ignored, ignored = CALL "Ichimoku perso"
ignored, ignored, ignored, ignored, indicator4 = CALL "Ichimoku perso"
c2 = (indicator3 > indicator4)
indicator5 = WeightedAverage[7](close)
indicator6 = TriangularAverage[7](close)
c3 = (indicator5 > indicator6)
c4 = close > indicator5
IF c1 AND c2 AND c3 AND c4 And not daysForbiddenEntry THEN
IF c1 AND c2 AND c3 AND c4 THEN
BUY 1 CONTRACT AT MARKET
ENDIF
//Conditions pour fermer une position acheteuse
indicator7 = 2*((DHigh(1) + DLow(1) + DClose(1))/3) - DLow(1)
c5 = (close >= indicator7)
ignored, indicator8 = CALL "base take profit achat 100"
c6 = (close >= indicator8)
IF c5 OR c6 THEN
SELL AT MARKET
ENDIF
// Conditions pour ouvrir une position en vente à découvert
ignored, indicator9, ignored, ignored, ignored = CALL "Ichimoku perso"
ignored, ignored, ignored, indicator10, ignored = CALL "Ichimoku perso"
c7 = (indicator9 < indicator10)
ignored, indicator11, ignored, ignored, ignored = CALL "Ichimoku perso"
ignored, ignored, ignored, ignored, indicator12 = CALL "Ichimoku perso"
c8 = (indicator11 < indicator12)
indicator13 = WeightedAverage[7](close)
indicator14 = TriangularAverage[7](close)
c9 = (indicator13 < indicator14)
c10 = close < indicator13
IF c7 AND c8 And c9 AND c10 AND not daysForbiddenEntry THEN
IF c7 AND c8 AND c9 AND c10 THEN
SELLSHORT 1 CONTRACT AT MARKET
ENDIF
// Conditions pour fermer une position en vente à découvert
indicator15 = 2*((DHigh(1) + DLow(1) + DClose(1))/3) - DHigh(1)
c11 = (close <= indicator15)
indicator16, ignored = CALL "base take profit achat 100"
c12 = (close <= indicator16)
IF c11 OR c12 THEN
EXITSHORT AT MARKET
ENDIF
// Stops et objectifs
SET STOP pLOSS 20
ENDIF
ENDIF