Bonjour
j ai poste un fichier concernant un souci de syntax
pouvez vous m aider
merci..
copie ce code dans probuilder
polarite8=average[8]
polarite21=average[21]
return polarite8 coloured(0,0,255) as "polarite8",polarite21 coloured(0,255,0)as"polarite21"
Merci de votre reponse… je joins un fichier .. je suis pas expert en codage si vous pouvez encore m aider… merci
Bonjour. Voici ton code sans erreurs.
periodFast = 7
periodSlow = 20
pullbackTolerance = 0.0005
maFast = average[periodFast](close)
maSlow = average[periodSlow](close)
crossUp = maFast crosses over maSlow
crossDown = maFast crosses under maSlow
pullbackToSlowUp = (low <= maSlow + pullbackTolerance AND high >= maSlow - pullbackTolerance)
pullbackToSlowDown = (high >= maSlow - pullbackTolerance AND low <= maSlow + pullbackTolerance)
buySignal = crossUp AND pullbackToSlowUp
sellSignal = crossDown AND pullbackToSlowDown
IF buySignal THEN
DRAWARROWup(barindex, low)coloured("green")
ENDIF
IF sellSignal THEN
DRAWARROWdown(barindex, high)coloured("red")
ENDIF
RETURN maFast coloured(0,0,255) as "Moyenne Rapide", maSlow coloured(0,255,0) as "Moyenne Lente"
Pour la prochaine fois, il vaut mieux que tu partages le code et tes questions directement ici. Pour partager du code, il te suffit de cliquer sur le bouton pour ajouter du code PRT.
Voici une petite variation de ton code pour détecter le pullback après le croisement et non pendant le croisement des moyennes.
Je n’ai pas voulu trop modifier la logique de ton code, simplement attendre que le croisement soit déjà effectué.
periodFast = 7
periodSlow = 20
pullbackTolerance = 0.0005
// CALCULO DE MEDIAS
maFast = average[periodFast](close)
maSlow = average[periodSlow](close)
crossUp = maFast CROSSES OVER maSlow
crossDown = maFast CROSSES UNDER maSlow
IF crossUp THEN
crossUpBar = barindex
checkpullbackToSlowUp=1
checkpullbackToSlowDown=0
elsif crossDown THEN
crossDownBar = barindex
checkpullbackToSlowUp=0
checkpullbackToSlowDown=1
ENDIF
IF crossDown THEN
crossDownBar = barindex
ENDIF
pullbackToSlowUp = (barindex > crossUpBar AND low <= maSlow + pullbackTolerance AND high >= maSlow - pullbackTolerance)
pullbackToSlowDown = (barindex > crossDownBar AND high >= maSlow - pullbackTolerance AND low <= maSlow + pullbackTolerance)
buySignal = pullbackToSlowUp AND BarsSince(crossUp) > 0 and checkpullbackToSlowUp
sellSignal = pullbackToSlowDown AND BarsSince(crossDown) > 0 and checkpullbackToSlowDown
IF buySignal THEN
DRAWARROWup(barindex, low)coloured("green")
ENDIF
IF sellSignal THEN
DRAWARROWdown(barindex, high)coloured("red")
ENDIF
RETURN maFast coloured(0,0,255) as "Moyenne Rapide", maSlow coloured(0,255,0) as "Moyenne Lente"
Bonjour
Actuellement je fais des test d indicateur …je ne suis pas un expert ..les corrections que vous avez apporter on bien fontioner mais je dois affiner merci de votre aide…j ai toujours des problème de syntax
pouvez vous faire une correction sur ce code ..
// — Module 1 : Détection Breaker Block M3 —
DEFPARAM CumulateOrders = False
// Cassure de structure simple (BOS haussier)
bosUp = close > highest[5](close[1])
// Cassure de structure baissière
bosDown = close < lowest[5](close[1])
// Enregistrer la zone du breaker block
IF bosUp THEN
breakerHigh = high
breakerLow = low
breakerMid = (breakerHigh + breakerLow) / 2
DRAWRECTANGLE(“BreakerHaussier”, barindex, breakerHigh, barindex+5, breakerLow) coloured(255,200,0)
ENDIF
IF bosDown THEN
breakerHigh = high
breakerLow = low
breakerMid = (breakerHigh + breakerLow) / 2
DRAWRECTANGLE(“BreakerBaissier”, barindex, breakerHigh, barindex+5, breakerLow) coloured(200,50,50)
ENDIF
Merci..
// — Module 1 : Détection Breaker Block M3 —
// Cassure de structure simple (BOS haussier)
bosUp = close > highest[5](close[1])
// Cassure de structure baissière
bosDown = close < lowest[5](close[1])
// Enregistrer la zone du breaker block
IF bosUp THEN
breakerHigh = high
breakerLow = low
breakerMid = (breakerHigh + breakerLow) / 2
DRAWRECTANGLE(barindex, breakerHigh, barindex+5, breakerLow) coloured(255,200,0)
ENDIF
IF bosDown THEN
breakerHigh = high
breakerLow = low
breakerMid = (breakerHigh + breakerLow) / 2
DRAWRECTANGLE(barindex, breakerHigh, barindex+5, breakerLow) coloured(200,50,50)
ENDIF
return
JSParticipant
Senior
Bonjour,
Il est important de bien faire la distinction entre les indicateurs et les systèmes de trading, car chacun a une syntaxe autorisée différente…
DefParam CumulateOrders = False appartient à un système de trading, et non à un indicateur…
De plus, un indicateur doit toujours se terminer par RETURN…
Essayez d’exécuter ce code sous le module « Indicateurs »…
// — Module 1 : Détection Breaker Block M3 —
//DEFPARAM CumulateOrders = False
// Cassure de structure simple (BOS haussier)
bosUp = close > highest[5](close[1])
// Cassure de structure baissière
bosDown = close < lowest[5](close[1])
// Enregistrer la zone du breaker block
IF bosUp THEN
breakerHigh = high
breakerLow = low
breakerMid = (breakerHigh + breakerLow) / 2
DRAWRECTANGLE(barindex, breakerHigh, barindex+5, breakerLow) coloured(255,200,0)
EndIf
IF bosDown THEN
breakerHigh = high
breakerLow = low
breakerMid = (breakerHigh + breakerLow) / 2
DRAWRECTANGLE(barindex, breakerHigh, barindex+5, breakerLow) coloured(200,50,50)
ENDIF
Return
bonjour
j essai de faire codage sur structure de marche probleme de syntax
merci pour la correction…
// Paramètre de sensibilité
DEFPARAM CumulateOrders = False
depth = 5
// Détection d’un Swing High (Haut de structure)
swingHigh = (high > highest[depth](high[1])) AND (high >= highest[depth](high[-depth]))
// Détection d’un Swing Low (Bas de structure)
swingLow = (low < lowest[depth](low[1])) AND (low <= lowest[depth](low[-depth]))
// Affichage des points
IF swingHigh THEN
DRAWSHAPE(1, style = shapeCircle, color = green, size = 2, position = aboveBar)
ENDIF
IF swingLow THEN
DRAWSHAPE(1, style = shapeCircle, color = red, size = 2, position = belowBar)
ENDIF
RETURN
deja enlever le – devant depth
Merci de votre reponse
ci joint fichier + erreur
Bonjour, à propos de la première erreur de la dernière image attachée, en ligne 2, comme JS l’a mentionné un peu plus haut pour le code précédent, l’instruction DEFPARAM CumulateOrders = False ne peut pas être utilisée dans un indicateur, il faut enlever cette ligne.
Bonjour à tous,
Je souhaite créer un indicateur pour identifier la structure de marché.
L’idée est très simple :
– Afficher un point vert lorsqu’un nouveau swing high est détecté (un plus haut local)
– Afficher un point rouge lorsqu’un nouveau swing low est détecté (un plus bas local)
Les conditions seraient basées sur la détection des plus hauts et plus bas relatifs sur un certain nombre de bougies (paramètre de profondeur).
En résumé :
✅ Point vert = swing high
✅ Point rouge = swing low
Je cherche donc un code simple qui permette de tracer automatiquement ces points sur le graphique.
Merci beaucoup pour votre aide !
JSParticipant
Senior
Bonjour,
Essayez cet indicateur…
Once Depth=5
If Highest[Depth*2+1](High)=High[Depth] then
DrawPoint(BarIndex-Depth,High[Depth],3)Coloured("Green")
EndIf
If Lowest[Depth*2+1](Low)=Low[Depth] then
DrawPoint(BarIndex-Depth,Low[Depth],3)Coloured("Red")
EndIf
Return