Bonjour,
Tout d’abord merci de vos retours.
1er point : en effet, les variables sont appelées dans le désordre, je ne l’avais pas remarqué. Celà étant, le problème persiste.
Voici l’appel de fonction modifié:
PPH, Res1H, Res2H , Res3H , Sup1H , Sup2H , Sup3H , PPM , Res1M , Res2M , Res3M , Sup1M , Sup2M , Sup3M = CALL DETECTpivots (Close)
et la FONCTION DETECTpivots (je n’ai pas trouvé comment exporté le code dans un fichier, désolé…)
//////////////////////////
// Pivots Hebdo et mensuel
//////////////////////////
Once mode = 0
Once lastWeekBarIndex = 0
Once weeklyHigh = undefined
Once weeklyLow = undefined
Once weeklyPivot = undefined
Once weeklyR1 = undefined
Once weeklyS1 = undefined
Once weeklyR2 = undefined
Once weeklyS2 = undefined
Once weeklyR3 = undefined
Once weeklyS3 = undefined
Once lastMonthBarIndex = 0
Once monthlyHigh = undefined
Once monthlyLow = undefined
Once monthlyPivot = undefined
Once monthlyR1 = undefined
Once monthlyS1 = undefined
Once monthlyR2 = undefined
Once monthlyS2 = undefined
Once monthlyR3 = undefined
Once monthlyS3 = undefined
//
// Pivot Hebdo //
IF DayOfWeek < DayOfWeek[1] THEN
Hveille = myH
Bveille = myB
Cveille = Close[1]
myH = High
myB = Low
ELSE
myH = Max(High, myH)
myB = Min(Low, myB)
ENDIF
PPH = (Hveille + Bveille + Cveille) / 3
Res1H = 2 * PPH - Bveille
Res2H = PPH + (Hveille - Bveille)
Res3H = Hveille + 2 * (PPH - Bveille)
Sup1H = 2 * PPH - Hveille
Sup2H = PPH - (Hveille - Bveille)
Sup3H = Bveille - 2 * (Hveille - PPH)
// Pivot Hebdo //
// Pivot Mensuel //
IF OpenMonth <> OpenMonth[1] THEN
myLastHigh = myHigh
myLastLow = myLow
myLastClose = Close[1]
myHigh = High
myLow = Low
ELSE
myHigh = Max(myHigh, High)
myLow = Min(myLow, Low)
ENDIF
PPM = (myLastHigh + myLastLow + myLastClose) / 3
Res1M = (2 * PPM) - myLastLow
Res2M = PPM + (myLastHigh - myLastLow)
Res3M = myLastHigh + 2 * (PPM - myLastLow)
Sup1M = (2 * PPM) - myLastHigh
Sup2M = PPM - (myLastHigh - myLastLow)
Sup3M = myLastLow - 2 * (myLastHigh - PPM)
/////////////////////////
if (IsLastBarUpdate ) THEN
DRAWTEXT(PPH , barindex, PPH)coloured (70,70,70)
DRAWTEXT(Res2H , barindex, Res2H )coloured (70,70,70)
DRAWTEXT(Res3M, barindex, Res3M )coloured (70,70,70)
DRAWTEXT(PPM , barindex, PPM)coloured (70,70,70)
DRAWTEXT(Res1H , barindex, Res1H )coloured (70,70,70)
DRAWTEXT(Res3H, barindex, Res3H )coloured (70,70,70)
DRAWTEXT(Res1M , barindex, Res1M)coloured (70,70,70)
DRAWTEXT(Res2M , barindex, Res2M )coloured (70,70,70)
DRAWTEXT(Sup1M, barindex, Sup1M )coloured (70,70,70)
DRAWTEXT(Sup2M , barindex, Sup2M)coloured (70,70,70)
DRAWTEXT(Sup3M , barindex, Sup3M )coloured (70,70,70)
DRAWTEXT(Sup1H , barindex, Sup1H )coloured (70,70,70)
DRAWTEXT(Sup2H , barindex, Sup2H )coloured (70,70,70)
DRAWTEXT(Sup3H , barindex, Sup3H )coloured (70,70,70)
ENDIF
Return PPH, Res1H, Res2H , Res3H , Sup1H , Sup2H , Sup3H , PPM , Res1M , Res2M , Res3M , Sup1M , Sup2M , Sup3M
//Return 130.1,130.12334,130,130,130,130,130,130.123456,130,130,130,130,130,130
//Return 130,130,130,130,130,130,130,130,130,130,130,130,130,130
//////////////////////////