BONJOUR
J’AI UN CODE POUR PRT-BAND ADAPTATIVES MAIS IL A UN PROBLEME SIGNAL2 LIGNE 10 QUAND JE TENTE DE LE METTRE SUR PRT;
QUELQU’
// PRT BAND ADAPTATIVE - Version avec KAMA et ATR Dynamique
// Auteur: Inspiré communauté ProRealCode (adapté pour volatilité adaptative)
// Paramètres
PeriodKAMA = 10 // Période KAMA (médiane adaptative)
ATRPeriod = 14 // Période ATR
BaseMultiplier = 2.0 // Multiplicateur de base
AdaptPeriod = 5 // Période adaptation (EMA sur ATR pour dynamisme)
// Calcul KAMA (Adaptive Moving Average)
ER = Abs(Close - Close[PeriodKAMA]) / Sum(Abs(Close - Close[1][PeriodKAMA] ) // Efficiency Ratio C'EST SUR CETTE LIGNE
SC = Pow((ER * (2/(2+1) - 2/(30+1)) + 2/(30+1)), 2) // Smoothing Constant
KAMA = 0
KAMA[1] = Close[PeriodKAMA]
FOR i = PeriodKAMA DOWNTO 1 DO
KAMA = KAMA[1] + SC * (Close - KAMA[1])
NEXT
// ATR Adaptatif
ATRValue = AverageTrueRange[ATRPeriod](Close)
AdaptATR = ExponentialAverage[AdaptPeriod](ATRValue) / ATRValue[1] // Ratio adaptation (1 = neutre)
Multiplier = BaseMultiplier * (1 + (AdaptATR - 1) * 0.5) // Dynamique : +50% max en expansion
// Bandes
UpperBand = KAMA + (ATRValue * Multiplier)
LowerBand = KAMA - (ATRValue * Multiplier)
// Plots (avec couleurs PRT Bands-like)
IF Close > UpperBand THEN
plotshape(UpperBand, "Bande Sup (Vert)", Green, style=curve, thickness=2)
plotshape(LowerBand, "Bande Inf (Vert)", Green, style=curve, thickness=2)
plotshape(KAMA, "Médiane (Vert)", Lime, style=curve, thickness=1)
ELSIF Close < LowerBand THEN
plotshape(UpperBand, "Bande Sup (Rouge)", Red, style=curve, thickness=2)
plotshape(LowerBand, "Bande Inf (Rouge)", Red, style=curve, thickness=2)
plotshape(KAMA, "Médiane (Rouge)", Maroon, style=curve, thickness=1)
ELSE
plotshape(UpperBand, "Bande Sup", Blue, style=curve, thickness=2)
plotshape(LowerBand, "Bande Inf", Blue, style=curve, thickness=2)
plotshape(KAMA, "Médiane", Cyan, style=curve, thickness=1)
ENDIF
// Alertes (optionnel)
IF CrossesOver(Close, UpperBand) THEN
ALERT("Breakout Haussier Adaptatif!")
ENDIF
IF CrossesUnder(Close, LowerBand) THEN
ALERT("Breakout Baissier Adaptatif!")
ENDIF
RETURN UpperBand SEPARATED BY LowerBand SEPARATED BY KAMA
UN PEUT IL M’AIDER SVP,
CDLT