defparam cumulateorders=false defparam flatafter=200000 //cloture des positions ouvertes à 20h00 // --- parametres HeureDebut = 080000 //horaire de debut de trading HeureFin = 200000 //horaire de fin de trading SeuilATR = 30 //seuil maximum de l'ATR pour la prise de position PerteMax = 300 //seuil de perte maximum jour en monnaie // --------------------- timeframe(2 minutes, updateonclose) st2=Supertrend[3,10] timeframe(30 seconds, updateonclose) if day<>day[1] then pnl=strategyprofit trading=1 endif if strategyprofit<>strategyprofit[1] then if strategyprofit<=pnl-pertemax then trading=0 endif endif st1=Supertrend[3,10] atr=AverageTrueRange[14](close) sto=Stochastic[4,1](close) buyc = sto crosses over 20 and close>st1 and atr<=seuilatr*pointsize timec = time>=HeureDebut and time st1) // Conditions pour fermer une position acheteuse If LongOnMarket AND close crosses under st1 THEN SELL AT MARKET endif if trading and timec then if not longonmarket and buyc and crossedAfterOpen then buy 1 contract at market set stop price st2 endif endif if onmarket then set stop price st2 endif