Bonjour, Lorsque je backtest ce système il ne se passe strictement rien : aucun ordre n’est simulé. Le système est hyper simple : un stop suiveur à l’achat, un autre stop suiveur à la vente. Les seules positions autorisées sont seulement les positions longues. Il doit y avoir une erreur évidente dans mon code, mais je ne la vois pas. Help! 😉 ////////////////////////////////////////////////////////////////////////////////////////// // VARIABLES ////////////////////////////////////////////////////////////////////////////////////////// //PriceBaseStage [1000], //DropConfirmationLevel [700;900][50] //BuyLevel [100;300][50] //RaiseConfirmationLevel[700;900][50] //SellLevel [100;300][50] ////////////////////////////////////////////////////////////////////////////////////////// // POSITIONS ////////////////////////////////////////////////////////////////////////////////////////// ONCE CapitalInitial = 10000 // Conditions pour ouvrir une position acheteuse IF NOT LongOnMarket AND ConditionAchat THEN Quantite = Round(0.9 * (CapitalInitial + StrategyProfit) / Close) BUY Quantite CONTRACTS AT MARKET ENDIF // Conditions pour fermer une position acheteuse If LongOnMarket AND ConditionVente THEN SELL AT MARKET ENDIF ////////////////////////////////////////////////////////////////////////////////////////// // CALCUL DES STOP LOSS ////////////////////////////////////////////////////////////////////////////////////////// // Initialisation ONCE StopLossBuy = -1 ONCE StopLossSell = -1 ONCE DropConfirmationPrice = PriceBaseStage * (ROUND(Close / PriceBaseStage) - 1) + DropConfirmationLevel ONCE RaiseConfirmationPrice = PriceBaseStage * ROUND(Close / PriceBaseStage) + RaiseConfirmationLevel // Suivre la baisse IF (Low <= DropConfirmationPrice[1]) THEN // La baisse est confirmée, on diminue le stop loss d'achat et la prochaine confirmation de baisse StopLossBuy = PriceBaseStage * ROUND(DropConfirmationPrice[1] / PriceBaseStage) + BuyLevel DropConfirmationPrice = DropConfirmationPrice[1] - PriceBaseStage ELSE StopLossBuy = StopLossBuy[1] DropConfirmationPrice = DropConfirmationPrice[1] ENDIF // Suivre la hausse IF (High >= RaiseConfirmationPrice[1]) THEN // La hausse est confirmée, on augmente le stop loss de vente et la prochaine confirmation de hausse StopLossSell = PriceBaseStage * (ROUND(RaiseConfirmationPrice[1] / PriceBaseStage) - 1) + SellLevel RaiseConfirmationPrice = RaiseConfirmationPrice[1] + PriceBaseStage ELSE StopLossSell = StopLossSell[1] RaiseConfirmationPrice = RaiseConfirmationPrice[1] ENDIF ////////////////////////////////////////////////////////////////////////////////////////// // CALCUL DES SIGNAUX ////////////////////////////////////////////////////////////////////////////////////////// // Condition pour ouvrir une position longue ConditionAchat = (High >= StopLossBuy[1]) // Condition pour clôturer une position longue ouverte ConditionVente = (Low <= StopLossSell[1])