Pullback sur moyenne mobile
Forums › ProRealTime forum Français › Support ProBuilder › Pullback sur moyenne mobile
- This topic has 52 replies, 7 voices, and was last updated 6 days ago by
bertrandpinoy.
-
-
07/22/2025 at 6:10 PM #24902407/22/2025 at 6:49 PM #24902607/22/2025 at 8:21 PM #24902707/23/2025 at 7:24 AM #249035
Bonjour. Voici ton code sans erreurs.
1234567891011121314151617181920212223242526periodFast = 7periodSlow = 20pullbackTolerance = 0.0005maFast = average[periodFast](close)maSlow = average[periodSlow](close)crossUp = maFast crosses over maSlowcrossDown = maFast crosses under maSlowpullbackToSlowUp = (low <= maSlow + pullbackTolerance AND high >= maSlow - pullbackTolerance)pullbackToSlowDown = (high >= maSlow - pullbackTolerance AND low <= maSlow + pullbackTolerance)buySignal = crossUp AND pullbackToSlowUpsellSignal = crossDown AND pullbackToSlowDownIF buySignal THENDRAWARROWup(barindex, low)coloured("green")ENDIFIF sellSignal THENDRAWARROWdown(barindex, high)coloured("red")ENDIFRETURN 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.
1 user thanked author for this post.
07/23/2025 at 7:31 AM #249036Voici 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é.12345678910111213141516171819202122232425262728293031323334353637383940periodFast = 7periodSlow = 20pullbackTolerance = 0.0005// CALCULO DE MEDIASmaFast = average[periodFast](close)maSlow = average[periodSlow](close)crossUp = maFast CROSSES OVER maSlowcrossDown = maFast CROSSES UNDER maSlowIF crossUp THENcrossUpBar = barindexcheckpullbackToSlowUp=1checkpullbackToSlowDown=0elsif crossDown THENcrossDownBar = barindexcheckpullbackToSlowUp=0checkpullbackToSlowDown=1ENDIFIF crossDown THENcrossDownBar = barindexENDIFpullbackToSlowUp = (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 checkpullbackToSlowUpsellSignal = pullbackToSlowDown AND BarsSince(crossDown) > 0 and checkpullbackToSlowDownIF buySignal THENDRAWARROWup(barindex, low)coloured("green")ENDIFIF sellSignal THENDRAWARROWdown(barindex, high)coloured("red")ENDIFRETURN maFast coloured(0,0,255) as "Moyenne Rapide", maSlow coloured(0,255,0) as "Moyenne Lente"2 users thanked author for this post.
07/24/2025 at 8:59 AM #249073Bonjour
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)
ENDIFIF bosDown THEN
breakerHigh = high
breakerLow = low
breakerMid = (breakerHigh + breakerLow) / 2
DRAWRECTANGLE(“BreakerBaissier”, barindex, breakerHigh, barindex+5, breakerLow) coloured(200,50,50)
ENDIFMerci..
07/24/2025 at 9:29 AM #24907412345678910111213141516171819202122// — Module 1 : Détection Breaker Block M3 —// Cassure de structure simple (BOS haussier)bosUp = close > highest[5](close[1])// Cassure de structure baissièrebosDown = close < lowest[5](close[1])// Enregistrer la zone du breaker blockIF bosUp THENbreakerHigh = highbreakerLow = lowbreakerMid = (breakerHigh + breakerLow) / 2DRAWRECTANGLE(barindex, breakerHigh, barindex+5, breakerLow) coloured(255,200,0)ENDIFIF bosDown THENbreakerHigh = highbreakerLow = lowbreakerMid = (breakerHigh + breakerLow) / 2DRAWRECTANGLE(barindex, breakerHigh, barindex+5, breakerLow) coloured(200,50,50)ENDIFreturn3 users thanked author for this post.
07/24/2025 at 9:36 AM #249075Bonjour,
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 »…
Indicator123456789101112131415161718192021222324// — 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èrebosDown = close < lowest[5](close[1])// Enregistrer la zone du breaker blockIF bosUp THENbreakerHigh = highbreakerLow = lowbreakerMid = (breakerHigh + breakerLow) / 2DRAWRECTANGLE(barindex, breakerHigh, barindex+5, breakerLow) coloured(255,200,0)EndIfIF bosDown THENbreakerHigh = highbreakerLow = lowbreakerMid = (breakerHigh + breakerLow) / 2DRAWRECTANGLE(barindex, breakerHigh, barindex+5, breakerLow) coloured(200,50,50)ENDIFReturn3 users thanked author for this post.
07/25/2025 at 4:25 PM #249098bonjour
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)
ENDIFIF swingLow THEN
DRAWSHAPE(1, style = shapeCircle, color = red, size = 2, position = belowBar)
ENDIFRETURN
07/25/2025 at 6:55 PM #24910107/25/2025 at 7:19 PM #24910207/25/2025 at 8:45 PM #24910407/26/2025 at 9:56 AM #249115Bonjour, à 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.
1 user thanked author for this post.
07/26/2025 at 6:09 PM #249122Bonjour à 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 lowJe cherche donc un code simple qui permette de tracer automatiquement ces points sur le graphique.
Merci beaucoup pour votre aide !
07/26/2025 at 8:15 PM #249125Bonjour,
Essayez cet indicateur…
Swing High Swing Low1234567891011Once Depth=5If Highest[Depth*2+1](High)=High[Depth] thenDrawPoint(BarIndex-Depth,High[Depth],3)Coloured("Green")EndIfIf Lowest[Depth*2+1](Low)=Low[Depth] thenDrawPoint(BarIndex-Depth,Low[Depth],3)Coloured("Red")EndIfReturn -
AuthorPosts
Find exclusive trading pro-tools on