Bonjour à tous,
Cela fait maintenant trop longtemps que je bloque sur un code, et j’aimerai avoir vos avis / idées.
Je cherche à avoir ‘graphiquement’ et en ‘valeurs utilisables’ les obliques resistance et support.
J’aimerai qu’à chaque début d’heure (je travaille en chandelle 1 minute, sur le MES0923) mon code, prenne comme premier point le point le plus haut de la journée, et test chaque high (après le point haut) comme deuxième point pour tirer une droite et vérifier que cette dernière n’est pas coupée.
Cela fonctionne très bien pour ma résistance, c’est parfait…
Quand je transpose mon code vers le support… J’ai un message d’erreur comme quoi une boucle est sans fin ou à trop d’itérations.
Pourtant c’est le même principe que pour la résistance, qui fonctionne très bien.
Après des milliers d’essais, si je “commente / dé-commente” les lignes 161 à 189 de mon code, la cela fonctionne, donc j’imagine que c’est la 2ème boucle que le code n’apprécie pas, mais je ne comprends pas pourquoi, ni comment surmonter ce problème.
Des idées?
N’hésitez pas à me dire s’il faut des explications plus précises,
Merci beaucoup d’avance,
Benjamin
Mon code juste en dessous, je n’arrive toujours pas à l’intégrer dans un post de forum.
Defparam DrawOnLastBarOnly = true
Defparam CalculateOnLastBars = 1500
//_________________________________________________________ TIMING
Heures = Hour
Miinutes = Minute
Secondes = Second
HeureDebutChandelle = HeureFinChandelle[1]
HeureFinChandelle = Hour * 10000 + Miinutes * 100 + Secondes
if HeureFinChandelle < HeureFinChandelle[1] then
HeureDebutChandelle = 0
endif
//______________________________________________ NOMBRE CHANDELLES
NombreChandelles = 1
if HeureDebutChandelle > HeureDebutChandelle[1] then
NombreChandelles = NombreChandelles[1] + 1
endif
//__________________________________________________ INFOS JOURNEE
if NombreChandelles < NombreChandelles[1] then
DebutJournee = barindex
OuvertureJournee = open
PlusBasJournee = min(Open,Close)
PlusHautJournee = max(Open,Close)
endif
//__________________________________________________ REMISE A 0
if NombreChandelles < NombreChandelles[1] then
ColonneArrayxArriveeRO = 0
ColonneArrayyArriveeRO = 0
ColonneArrayxArriveeSO = 0
ColonneArrayyArriveeSO = 0
endif
//__________________________________________________ BLOCKS
Block = 60
BlockPerDay = (60 / Block) * 24
for i = 1 to BlockPerDay do
drawvline (DebutJournee + (i * Block)) style (dottedline) coloured (180,180,180,100)
next
//__________________________________________________ COORDONEES PLUS HAUT
if High >= PlusHautJournee then
PlusHautJournee = High
xPH = Barindex
yPH = High
endif
//__________________________________________________ COORDONEES PLUS BAS
if Low <= PlusBasJournee then
PlusBasJournee = Low
xPB = Barindex
yPB = Low
endif
//__________________________________________________ LOOKBACK
BlockLine = (NombreChandelles / Block) - ceil((NombreChandelles / Block))
if BlockLine < BlockLine[1] then
xFinScanOblique = barindex[1]
SignalBlock = 1
else
SignalBlock = 0
endif
Drawvline (xFinScanOblique) coloured ("blue")
//__________________________________________________ RESISTANCE OBLIQUE
if SignalBlock = 1 and xFinScanOblique >= xDepartRO then
xDepartRO = xPH
yDepartRO = yPH
for i = xDepartRO + 1 to xFinScanOblique do
xArriveeRO = i
yArriveeRO = high[Barindex - xArriveeRO]
for j = xDepartRO + 1 to xFinScanOblique do
RO = (((yArriveeRO - yDepartRO) / (xArriveeRO - xDepartRO)) * j) + (yDepartRO - ((((yArriveeRO - yDepartRO ) / (xArriveeRO - xDepartRO)) * xDepartRO)))
if RO < high[Barindex - j] then
break
endif
if RO >= high[Barindex - j] then
if j = xFinScanOblique then
xArriveeRO = i
$ArrayxArriveeRO[ColonneArrayxArriveeRO] = xArriveeRO
ColonneArrayxArriveeRO = ColonneArrayxArriveeRO + 1
yArriveeRO = high[Barindex - xArriveeRO]
$ArrayyArriveeRO[ColonneArrayyArriveeRO] = yArriveeRO
ColonneArrayyArriveeRO = ColonneArrayyArriveeRO + 1
break
endif
endif
next
next
endif
if ColonneArrayxArriveeRO > 0 and xFinScanOblique > xDepartRO then
xArriveeRO = $ArrayxArriveeRO[ColonneArrayxArriveeRO-1]
yArriveeRO = $ArrayyArriveeRO[ColonneArrayyArriveeRO-1]
drawpoint (xDepartRO, yDepartRO, 1) coloured ("red")
drawpoint (xArriveeRO, yArriveeRO, 1) coloured ("red")
drawline(xDepartRO, yDepartRO, xArriveeRO, yArriveeRO) coloured ("red")
aRO = ((yArriveeRO - yDepartRO) / (xArriveeRO - xDepartRO))
bRO = (yDepartRO - ((((yArriveeRO - yDepartRO ) / (xArriveeRO - xDepartRO)) * xDepartRO)))
RO = (aRO * Barindex) + bRO
endif
//__________________________________________________ SUPPORT OBLIQUE
if SignalBlock = 1 and xFinScanOblique >= xDepartSO then
xDepartSO = xPB
yDepartSO = yPB
for i = xDepartSO + 1 to xFinScanOblique do
xArriveeSO = i
yArriveeSO = Low[Barindex - xArriveeSO]
//for j = xDepartSO + 1 to xFinScanOblique do
//
//SO = (((yArriveeSO - yDepartSO) / (xArriveeSO - xDepartSO)) * j) + (yDepartSO - ((((yArriveeSO - yDepartSO ) / (xArriveeSO - xDepartSO)) * xDepartSO)))
//
//if SO > Low[Barindex - j] then
//
//break
//
//endif
//
//if SO <= Low[Barindex - j] then
//
//if j = xFinScanOblique then
//
//xArriveeSO = i
//
//$ArrayxArriveeSO[ColonneArrayxArriveeSO] = xArriveeSO
//
//ColonneArrayxArriveeSO = ColonneArrayxArriveeSO + 1
//
//yArriveeSO = Low[Barindex - xArriveeSO]
//
//$ArrayyArriveeSO[ColonneArrayyArriveeSO] = yArriveeSO
//
//ColonneArrayyArriveeSO = ColonneArrayyArriveeSO + 1
//break
//endif
//endif
//next
next
endif
drawvline(xDepartSO)
if ColonneArrayxArriveeSO > 0 and xFinScanOblique > xDepartSO then
xArriveeSO = $ArrayxArriveeSO[ColonneArrayxArriveeSO-1]
yArriveeSO = $ArrayyArriveeSO[ColonneArrayyArriveeSO-1]
drawpoint (xDepartSO, yDepartSO, 1) coloured ("green")
drawpoint (xArriveeSO, yArriveeSO, 1) coloured ("green")
drawline(xDepartSO, yDepartSO, xArriveeSO, yArriveeSO) coloured ("green")
aSO = ((yArriveeSO - yDepartSO) / (xArriveeSO - xDepartSO))
bSO = (yDepartSO - ((((yArriveeSO - yDepartSO ) / (xArriveeSO - xDepartSO)) * xDepartSO)))
SO = (aSO * Barindex) + bSO
endif
return