ProRealCode - Trading & Coding with ProRealTime™
Bonjour, je souhaiterais savoir s’il était possible de créer l’indicateur ci-dessous pour PRT ?
Je vous remercie
voici la traduction du code a verifier quand meme
//@version=5
//indicator("Dynamic Trading Strategy with Key Levels, Entry/Exit Management", overlay=true)
defparam drawonlastbaronly=true
// Input Parameters
lookbackPeriod = 20// Lookback Period for Key Levels
atrPeriod = 14//ATR Period
atrMultiplierSL = 1.5//SL ATR Multiplier
atrMultiplierTP1 = 1.5//TP1 ATR Multiplier
atrMultiplierTP2 = 2.0//TP2 ATR Multiplier
rewardToRisk = 2.0//Reward to Risk Ratio
// ATR and Volume Calculation
atr = AverageTrueRange[atrPeriod](close)
volumeSMA = Average[atrPeriod](Volume )
// Key Levels Identification (Support & Resistance Zones)
support = lowest[lookbackPeriod](low)
resistance = highest[lookbackPeriod](high)
supportBuffer = support - atr * 0.5
resistanceBuffer = resistance + atr * 0.5
// Define Bullish and Bearish Scenario Entry Ranges (Visualized with Boxes)
once bullishBox = Undefined
once bearishBox = Undefined
// Bullish Scenario
isBullishEntry = (close > supportBuffer) and (low <= support) and (volume > volumeSMA)
if isBullishEntry then
if bullishBox then
DRAWRECTANGLE(barindex- 10, support + atr * 0.5 ,barindex+ 10, support - atr * 0.5) COLOURED("green") BORDERCOLOR("green")
else
DRAWRECTANGLE(barindex- 10, support + atr * 0.5 ,barindex+ 10, support - atr * 0.5) COLOURED("green")BORDERCOLOR("green")
endif
endif
// Bearish Scenario
isBearishEntry = (close < resistanceBuffer) and (high >= resistance) and (volume > volumeSMA)
if isBearishEntry then
if bearishBox then
DRAWRECTANGLE(barindex- 10, resistance + atr * 0.5 ,barindex+ 10, resistance- atr * 0.5) COLOURED("red")BORDERCOLOR("red")
else
DRAWRECTANGLE(barindex- 10, resistance + atr * 0.5 ,barindex+ 10, resistance- atr * 0.5) COLOURED("red")BORDERCOLOR("red")
endif
endif
// Stop Loss and Take Profit Calculations for Bullish and Bearish Scenarios
bullishSL = support - atr * atrMultiplierSL
bullishTP1 = support + atr * rewardToRisk * atrMultiplierTP1
bullishTP2 = support + atr * rewardToRisk * atrMultiplierTP2
bearishSL = resistance + atr * atrMultiplierSL
bearishTP1 = resistance - atr * rewardToRisk * atrMultiplierTP1
bearishTP2 = resistance - atr * rewardToRisk * atrMultiplierTP2
// Visualization for Bullish Scenario (TP1, TP2, SL Lines with Labels)
once bullishTP1Line = Undefined
once bullishTP2Line = Undefined
once bullishSLLine = Undefined
once bullishTP1Label = Undefined
once bullishTP2Label = Undefined
once bullishSLLabel = Undefined
if isBullishEntry then
if bullishTP1Line then
DRAWSEGMENT(barindex- 10, bullishTP1, barindex+ 10, bullishTP1) coloured("green")style(line,2)
else
DRAWSEGMENT(barindex- 10, bullishTP1, barindex+ 10, bullishTP1) coloured("green")style(line,2)
endif
if bullishTP1Label then
DRAWTEXT("TP1", barindex+ 10, bullishTP1) coloured("green")
else
DRAWTEXT("TP1", barindex+ 10, bullishTP1) coloured("green")
endif
if bullishTP2Line then
DRAWSEGMENT(barindex- 10, bullishTP2, barindex+ 10, bullishTP2) coloured("green")style(line,2)
else
DRAWSEGMENT(barindex- 10, bullishTP2, barindex+ 10, bullishTP2) coloured("green")style(line,2)
endif
if bullishTP2Label then
DRAWTEXT("TP2", barindex+ 10, bullishTP2) coloured("green")
else
DRAWTEXT("TP2", barindex+ 10, bullishTP2) coloured("green")
endif
if bullishSLLine then
DRAWSEGMENT(barindex- 10, bullishSL, barindex+ 10, bullishSL) coloured("red")style(line,2)
else
DRAWSEGMENT(barindex- 10, bullishSL, barindex+ 10, bullishSL) coloured("red")style(line,2)
endif
if bullishSLLabel then
DRAWTEXT("SL", barindex+ 10, bullishSL) coloured("red")
else
DRAWTEXT("SL", barindex+ 10, bullishSL) coloured("red")
endif
endif
// Visualization for Bearish Scenario (TP1, TP2, SL Lines with Labels)
once bearishTP1Line = Undefined
once bearishTP2Line = Undefined
once bearishSLLine = Undefined
once bearishTP1Label = Undefined
once bearishTP2Label = Undefined
once bearishSLLabel = Undefined
if isBearishEntry then
if bearishTP1Line then
DRAWSEGMENT(barindex- 10, bearishTP1, barindex+ 10, bearishTP1) coloured("red")style(line,2)
else
DRAWSEGMENT(barindex- 10, bearishTP1, barindex+ 10, bearishTP1) coloured("red")style(line,2)
endif
if bearishTP1Label then
DRAWTEXT("TP1", barindex+ 10, bearishTP1) coloured("red")
else
DRAWTEXT("TP1", barindex+ 10, bearishTP1) coloured("red")
endif
if bearishTP2Line then
DRAWSEGMENT(barindex- 10, bearishTP2, barindex+ 10, bearishTP2) coloured("red")style(line,2)
else
DRAWSEGMENT(barindex- 10, bearishTP2, barindex+ 10, bearishTP2) coloured("red")style(line,2)
endif
if bearishTP2Label then
DRAWTEXT("TP1", barindex+ 10, bearishTP2) coloured("red")
else
DRAWTEXT("TP1", barindex+ 10, bearishTP2) coloured("red")
endif
if bearishSLLine then
DRAWSEGMENT(barindex- 10, bearishSL, barindex+ 10, bearishSL) coloured("green")style(line,2)
else
DRAWSEGMENT(barindex- 10, bearishSL, barindex+ 10, bearishSL) coloured("green")style(line,2)
endif
if bearishSLLabel then
DRAWTEXT("SL", barindex+ 10, bearishSL) coloured("green")
else
DRAWTEXT("SL", barindex+ 10, bearishSL) coloured("green")
endif
endif
return
Merci pour la traduction.
Encore un indicateur à ne surtout pas utiliser au vu des résultats (mettre la ligne 3 en commentaire, pour voir les trades proposés par l’indicateur sur tout l’historique) décevant…
voici la traduction du code a verifier quand meme
//@version=5
//indicator(“Dynamic Trading Strategy with Key Levels, Entry/Exit Management”, overlay=true)
defparam drawonlastbaronly=true
// Input Parameters
lookbackPeriod = 20// Lookback Period for Key Levels
atrPeriod = 14//ATR Period
atrMultiplierSL = 1.5//SL ATR Multiplier
atrMultiplierTP1 = 1.5//TP1 ATR Multiplier
atrMultiplierTP2 = 2.0//TP2 ATR Multiplier
rewardToRisk = 2.0//Reward to Risk Ratio// ATR and Volume Calculation
atr = AverageTrueRange[atrPeriod](close)
volumeSMA = Average[atrPeriod](Volume )// Key Levels Identification (Support & Resistance Zones)
support = lowest[lookbackPeriod](low)
resistance = highest[lookbackPeriod](high)
supportBuffer = support – atr * 0.5
resistanceBuffer = resistance + atr * 0.5// Define Bullish and Bearish Scenario Entry Ranges (Visualized with Boxes)
once bullishBox = Undefined
once bearishBox = Undefined// Bullish Scenario
isBullishEntry = (close > supportBuffer) and (low <= support) and (volume > volumeSMA)
if isBullishEntry then
if bullishBox then
DRAWRECTANGLE(barindex- 10, support + atr * 0.5 ,barindex+ 10, support – atr * 0.5) COLOURED(“green”) BORDERCOLOR(“green”)
else
DRAWRECTANGLE(barindex- 10, support + atr * 0.5 ,barindex+ 10, support – atr * 0.5) COLOURED(“green”)BORDERCOLOR(“green”)endif
endif
// Bearish Scenario
isBearishEntry = (close < resistanceBuffer) and (high >= resistance) and (volume > volumeSMA)
if isBearishEntry then
if bearishBox then
DRAWRECTANGLE(barindex- 10, resistance + atr * 0.5 ,barindex+ 10, resistance- atr * 0.5) COLOURED(“red”)BORDERCOLOR(“red”)else
DRAWRECTANGLE(barindex- 10, resistance + atr * 0.5 ,barindex+ 10, resistance- atr * 0.5) COLOURED(“red”)BORDERCOLOR(“red”)
endif
endif
// Stop Loss and Take Profit Calculations for Bullish and Bearish Scenarios
bullishSL = support – atr * atrMultiplierSL
bullishTP1 = support + atr * rewardToRisk * atrMultiplierTP1
bullishTP2 = support + atr * rewardToRisk * atrMultiplierTP2bearishSL = resistance + atr * atrMultiplierSL
bearishTP1 = resistance – atr * rewardToRisk * atrMultiplierTP1
bearishTP2 = resistance – atr * rewardToRisk * atrMultiplierTP2// Visualization for Bullish Scenario (TP1, TP2, SL Lines with Labels)
once bullishTP1Line = Undefined
once bullishTP2Line = Undefined
once bullishSLLine = Undefined
once bullishTP1Label = Undefined
once bullishTP2Label = Undefined
once bullishSLLabel = Undefinedif isBullishEntry then
if bullishTP1Line then
DRAWSEGMENT(barindex- 10, bullishTP1, barindex+ 10, bullishTP1) coloured(“green”)style(line,2)
else
DRAWSEGMENT(barindex- 10, bullishTP1, barindex+ 10, bullishTP1) coloured(“green”)style(line,2)
endif
if bullishTP1Label then
DRAWTEXT(“TP1”, barindex+ 10, bullishTP1) coloured(“green”)else
DRAWTEXT(“TP1”, barindex+ 10, bullishTP1) coloured(“green”)
endif
if bullishTP2Line then
DRAWSEGMENT(barindex- 10, bullishTP2, barindex+ 10, bullishTP2) coloured(“green”)style(line,2)
else
DRAWSEGMENT(barindex- 10, bullishTP2, barindex+ 10, bullishTP2) coloured(“green”)style(line,2)
endif
if bullishTP2Label then
DRAWTEXT(“TP2”, barindex+ 10, bullishTP2) coloured(“green”)
else
DRAWTEXT(“TP2”, barindex+ 10, bullishTP2) coloured(“green”)
endif
if bullishSLLine then
DRAWSEGMENT(barindex- 10, bullishSL, barindex+ 10, bullishSL) coloured(“red”)style(line,2)else
DRAWSEGMENT(barindex- 10, bullishSL, barindex+ 10, bullishSL) coloured(“red”)style(line,2)
endif
if bullishSLLabel then
DRAWTEXT(“SL”, barindex+ 10, bullishSL) coloured(“red”)else
DRAWTEXT(“SL”, barindex+ 10, bullishSL) coloured(“red”)
endif
endif
// Visualization for Bearish Scenario (TP1, TP2, SL Lines with Labels)
once bearishTP1Line = Undefined
once bearishTP2Line = Undefined
once bearishSLLine = Undefined
once bearishTP1Label = Undefined
once bearishTP2Label = Undefined
once bearishSLLabel = Undefinedif isBearishEntry then
if bearishTP1Line then
DRAWSEGMENT(barindex- 10, bearishTP1, barindex+ 10, bearishTP1) coloured(“red”)style(line,2)else
DRAWSEGMENT(barindex- 10, bearishTP1, barindex+ 10, bearishTP1) coloured(“red”)style(line,2)
endif
if bearishTP1Label then
DRAWTEXT(“TP1”, barindex+ 10, bearishTP1) coloured(“red”)else
DRAWTEXT(“TP1”, barindex+ 10, bearishTP1) coloured(“red”)
endif
if bearishTP2Line then
DRAWSEGMENT(barindex- 10, bearishTP2, barindex+ 10, bearishTP2) coloured(“red”)style(line,2)else
DRAWSEGMENT(barindex- 10, bearishTP2, barindex+ 10, bearishTP2) coloured(“red”)style(line,2)
endif
if bearishTP2Label then
DRAWTEXT(“TP1”, barindex+ 10, bearishTP2) coloured(“red”)else
DRAWTEXT(“TP1”, barindex+ 10, bearishTP2) coloured(“red”)
endif
if bearishSLLine then
DRAWSEGMENT(barindex- 10, bearishSL, barindex+ 10, bearishSL) coloured(“green”)style(line,2)else
DRAWSEGMENT(barindex- 10, bearishSL, barindex+ 10, bearishSL) coloured(“green”)style(line,2)
endif
if bearishSLLabel then
DRAWTEXT(“SL”, barindex+ 10, bearishSL) coloured(“green”)else
DRAWTEXT(“SL”, barindex+ 10, bearishSL) coloured(“green”)
endif
endif
return123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144//@version=5//indicator(“Dynamic Trading Strategy with Key Levels, Entry/Exit Management”, overlay=true)defparam drawonlastbaronly=true// Input ParameterslookbackPeriod = 20// Lookback Period for Key LevelsatrPeriod = 14//ATR PeriodatrMultiplierSL = 1.5//SL ATR MultiplieratrMultiplierTP1 = 1.5//TP1 ATR MultiplieratrMultiplierTP2 = 2.0//TP2 ATR MultiplierrewardToRisk = 2.0//Reward to Risk Ratio// ATR and Volume Calculationatr = AverageTrueRange[atrPeriod](close)volumeSMA = Average[atrPeriod](Volume )// Key Levels Identification (Support & Resistance Zones)support = lowest[lookbackPeriod](low)resistance = highest[lookbackPeriod](high)supportBuffer = support – atr * 0.5resistanceBuffer = resistance + atr * 0.5// Define Bullish and Bearish Scenario Entry Ranges (Visualized with Boxes)once bullishBox = Undefinedonce bearishBox = Undefined// Bullish ScenarioisBullishEntry = (close > supportBuffer) and (low <= support) and (volume > volumeSMA)if isBullishEntry thenif bullishBox thenDRAWRECTANGLE(barindex– 10, support + atr * 0.5 ,barindex+ 10, support – atr * 0.5) COLOURED(“green”) BORDERCOLOR(“green”)elseDRAWRECTANGLE(barindex– 10, support + atr * 0.5 ,barindex+ 10, support – atr * 0.5) COLOURED(“green”)BORDERCOLOR(“green”)endifendif// Bearish ScenarioisBearishEntry = (close < resistanceBuffer) and (high >= resistance) and (volume > volumeSMA)if isBearishEntry thenif bearishBox thenDRAWRECTANGLE(barindex– 10, resistance + atr * 0.5 ,barindex+ 10, resistance– atr * 0.5) COLOURED(“red”)BORDERCOLOR(“red”)elseDRAWRECTANGLE(barindex– 10, resistance + atr * 0.5 ,barindex+ 10, resistance– atr * 0.5) COLOURED(“red”)BORDERCOLOR(“red”)endifendif// Stop Loss and Take Profit Calculations for Bullish and Bearish ScenariosbullishSL = support – atr * atrMultiplierSLbullishTP1 = support + atr * rewardToRisk * atrMultiplierTP1bullishTP2 = support + atr * rewardToRisk * atrMultiplierTP2bearishSL = resistance + atr * atrMultiplierSLbearishTP1 = resistance – atr * rewardToRisk * atrMultiplierTP1bearishTP2 = resistance – atr * rewardToRisk * atrMultiplierTP2// Visualization for Bullish Scenario (TP1, TP2, SL Lines with Labels)once bullishTP1Line = Undefinedonce bullishTP2Line = Undefinedonce bullishSLLine = Undefinedonce bullishTP1Label = Undefinedonce bullishTP2Label = Undefinedonce bullishSLLabel = Undefinedif isBullishEntry thenif bullishTP1Line thenDRAWSEGMENT(barindex– 10, bullishTP1, barindex+ 10, bullishTP1) coloured(“green”)style(line,2)elseDRAWSEGMENT(barindex– 10, bullishTP1, barindex+ 10, bullishTP1) coloured(“green”)style(line,2)endifif bullishTP1Label thenDRAWTEXT(“TP1”, barindex+ 10, bullishTP1) coloured(“green”)elseDRAWTEXT(“TP1”, barindex+ 10, bullishTP1) coloured(“green”)endifif bullishTP2Line thenDRAWSEGMENT(barindex– 10, bullishTP2, barindex+ 10, bullishTP2) coloured(“green”)style(line,2)elseDRAWSEGMENT(barindex– 10, bullishTP2, barindex+ 10, bullishTP2) coloured(“green”)style(line,2)endifif bullishTP2Label thenDRAWTEXT(“TP2”, barindex+ 10, bullishTP2) coloured(“green”)elseDRAWTEXT(“TP2”, barindex+ 10, bullishTP2) coloured(“green”)endifif bullishSLLine thenDRAWSEGMENT(barindex– 10, bullishSL, barindex+ 10, bullishSL) coloured(“red”)style(line,2)elseDRAWSEGMENT(barindex– 10, bullishSL, barindex+ 10, bullishSL) coloured(“red”)style(line,2)endifif bullishSLLabel thenDRAWTEXT(“SL”, barindex+ 10, bullishSL) coloured(“red”)elseDRAWTEXT(“SL”, barindex+ 10, bullishSL) coloured(“red”)endifendif// Visualization for Bearish Scenario (TP1, TP2, SL Lines with Labels)once bearishTP1Line = Undefinedonce bearishTP2Line = Undefinedonce bearishSLLine = Undefinedonce bearishTP1Label = Undefinedonce bearishTP2Label = Undefinedonce bearishSLLabel = Undefinedif isBearishEntry thenif bearishTP1Line thenDRAWSEGMENT(barindex– 10, bearishTP1, barindex+ 10, bearishTP1) coloured(“red”)style(line,2)elseDRAWSEGMENT(barindex– 10, bearishTP1, barindex+ 10, bearishTP1) coloured(“red”)style(line,2)endifif bearishTP1Label thenDRAWTEXT(“TP1”, barindex+ 10, bearishTP1) coloured(“red”)elseDRAWTEXT(“TP1”, barindex+ 10, bearishTP1) coloured(“red”)endifif bearishTP2Line thenDRAWSEGMENT(barindex– 10, bearishTP2, barindex+ 10, bearishTP2) coloured(“red”)style(line,2)elseDRAWSEGMENT(barindex– 10, bearishTP2, barindex+ 10, bearishTP2) coloured(“red”)style(line,2)endifif bearishTP2Label thenDRAWTEXT(“TP1”, barindex+ 10, bearishTP2) coloured(“red”)elseDRAWTEXT(“TP1”, barindex+ 10, bearishTP2) coloured(“red”)endifif bearishSLLine thenDRAWSEGMENT(barindex– 10, bearishSL, barindex+ 10, bearishSL) coloured(“green”)style(line,2)elseDRAWSEGMENT(barindex– 10, bearishSL, barindex+ 10, bearishSL) coloured(“green”)style(line,2)endifif bearishSLLabel thenDRAWTEXT(“SL”, barindex+ 10, bearishSL) coloured(“green”)elseDRAWTEXT(“SL”, barindex+ 10, bearishSL) coloured(“green”)endifendifreturn
Merci bcp pour la traduction.
Merci pour la traduction.
Encore un indicateur à ne surtout pas utiliser au vu des résultats (mettre la ligne 3 en commentaire, pour voir les trades proposés par l’indicateur sur tout l’historique) décevant…
Bjr,
Je ne comprend pas quand vous dites mettre la ligne 3 en commentaire pour voir les trades proposés ? Pouvez-vous m’éclairer ? Je vous remercie.
Lucasbest
Déjà si tu trades cfd c’est encore pire car pour trader un marché il faut le carnet d’ordre et une profondeur assez vaste du matché j’ai eu le commercial il m’a dit que bientôt prorealtime va pouvoir afficher 20 lignes au carnet d’ordre…..
Merci pour la traduction.
Encore un indicateur à ne surtout pas utiliser au vu des résultats (mettre la ligne 3 en commentaire, pour voir les trades proposés par l’indicateur sur tout l’historique) décevant…
Bjr,
Je ne comprend pas quand vous dites mettre la ligne 3 en commentaire pour voir les trades proposés ? Pouvez-vous m’éclairer ? Je vous remercie.
La ligne “defparam drawonlastbaronly=true” (3ème ligne) stipule que seules les signaux détectés lors de la dernière bougie vont être affichés… Du coup pour voir tous les signaux détectés par l’indicateur (dans le passé), il faut mettre la ligne 3 en commentaire.
=>
Il faut mettre “//” devant “defparam drawonlastbaronly=true” : tout ce qui suit les 2 “//” est considéré par prorealtime comme un commentaire…
Lucasbest
Déjà si tu trades cfd c’est encore pire car pour trader un marché il faut le carnet d’ordre et une profondeur assez vaste du matché j’ai eu le commercial il m’a dit que bientôt prorealtime va pouvoir afficher 20 lignes au carnet d’ordre…..
Ce qui m’embête le plus chez Prorealtime, c’est surtout le lag entre ce qui s’affiche sur le chart et les cours en temps réel… J’ai parfois 3 à 4 seconde de décalage ; ne serait ce qu’en regardant les cours sur le site d’Ig et ce de Prorealtime (via IG). J’ai littéralement 3 à 5 secondes de retard si ce n’est plus. Et je trouve ça beaucoup plus grave que de ne pas avoir le carnet d’ordre que je n’utilise pas perso…
Et pourtant je jette l’éponge sur tout le reste….je ne prend que le carnet d’ordre mais il faut payer pas loin de 40€ par mois pour avoir 10 lignes….et j’ai regarder il y a aussi un gros lag entre le graphique et le carnet d’ordre…..et j’ai étudier pas mal et ce que je peux te dire les ordres limites qui sont cachés c’est ça qui fait le marché et pas les ordres agressifs qui sont visibles par tout le monde….
Quel miracle !!!!!!!
cela fait 10 ans que je réclame un carnet d’ordre digne de ce nom avec la profondeur de marché.
20 lignes c’est un début
QUID du carnet entier
Ca coute ?????
Merci énormément pour la traduction du code.
Cependant, mais peut-être que je m’y prends mal (suis pas un spécialiste lol), lorsque j’essaye de le créer sur PRT, cela ne fonctionne pas !
Je parviens à créer l’indicateur sur prix, le code s’affiche bien (à droite de la liste des indicateurs prédéfinis) mais rien ne s’affiche sur le graphique ?
Sans vouloir abuser, pouvez-vous m’aider ?
Mille mercis d’avance.
Dynamic Trading Strategy
This topic contains 10 replies,
has 5 voices, and was last updated by Poupouille
1 year, 5 months ago.
| Forum: | ProBuilder : Indicateurs & Outils Personnalisés |
| Language: | French |
| Started: | 12/20/2024 |
| Status: | Active |
| Attachments: | 3 files |
The information collected on this form is stored in a computer file by ProRealCode to create and access your ProRealCode profile. This data is kept in a secure database for the duration of the member's membership. They will be kept as long as you use our services and will be automatically deleted after 3 years of inactivity. Your personal data is used to create your private profile on ProRealCode. This data is maintained by SAS ProRealCode, 407 rue Freycinet, 59151 Arleux, France. If you subscribe to our newsletters, your email address is provided to our service provider "MailChimp" located in the United States, with whom we have signed a confidentiality agreement. This company is also compliant with the EU/Swiss Privacy Shield, and the GDPR. For any request for correction or deletion concerning your data, you can directly contact the ProRealCode team by email at privacy@prorealcode.com If you would like to lodge a complaint regarding the use of your personal data, you can contact your data protection supervisory authority.