Marketprofile: This is a complex script with various functions, including volume profile calculation, market session detection (such as the Asian session), opening range breakout management, and much more.
It uses a combination of technical analysis methods such as ATR (Average True Range), VPOC (Volume Point of Control), VAH (Value Area High), VAL (Value Area Low) and draws various graphical elements on the chart for visualization such as rectangles, lines and arrows to highlight price levels or important events.
The code is structured with several control flow instructions (if-else, while loops) to analyze price and volume data at different times of the day, with the aim of identifying potential trading opportunities. It adjusts dynamically according to market activity and makes extensive use of variables and arrays to store and manipulate data throughout the trading session.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 |
//defparam drawonlastbaronly=true //HourStart=1 //HourStop=23 starttimeUS = 151500 endtimeUS = 153000 IB=061000 atr=AverageTrueRange[14](close) dataOggi=date debutL = 143000 finL = 153000 //ScaleFactor=20 //NbrBars=200 dataTemp=dataOggi Conteggio=0 ValMinMaxFactor=1 Conteggio=0 valvolperc=0.7 once SelEnd=0 once SelStart=0 once CountDays=0 once PrezzoChiusura=0 once PrezzoApertura=0 once PrezzoLow=0 once PrezzoHigh=0 once ColoreSfondo=0 once LastStartBarIndex=0 once LastStopBarIndex=0 once LastPrezzoChiusura=0 //while CountDays=Maxdays do Conteggio=Conteggio+1 if date[Conteggio]<> dataTemp then CountDays=CountDays+1 SelEnd=0 SelStart=0 //PrezzoChiusura=0 endif OraBarra=hour[Conteggio] MinMaxFactor=ValMinMaxFactor*pipsize DiffHigh=abs(high[1]-high[2]) DiffMin=abs(low[1]-low[2]) //MinutiBarra=minute[Conteggio] if OraBarra=HourStart and SelStart=0 then DRAWVLINE(Barindex[Conteggio])Coloured(0,100,0) if Close[conteggio]>PrezzoChiusura then //Green R=127 G=255 B=0 else R=255 G=0 B=0 endif //DRAWRECTANGLE(Barindex[Conteggio],Close[conteggio],Barindex,PrezzoChiusura) Coloured(R,G,B) //DRAWTEXT("GAP", barindex, (Close[conteggio]+PrezzoChiusura)/2) DayStart=day MonthStart=month if DayStart and MonthStart then endif PrezzoApertura=open[Conteggio] SelStart=1 ColoreSfondo=0 LastStartBarIndex=barindex //DisegnaLariga endif if OraBarra=HourStop and SelEnd=0 then PrezzoChiusura=close[Conteggio] DayStop=day MonthStop=month //Calcolo POC StopLookback=barindex-LastStartBarIndex hh=highest[StopLookback](high) ll=lowest[StopLookback](low) op=open div = (hh-ll)/NbrBars i=0 volsum=summation[StopLookback](volume) startbar = barindex[StopLookback] maxbar = 0 checkprice = ll MaxTouch1 = 0 //step = 10 while i<NbrBars do lrange=ll+div*i hrange=lrange+div volbull=0 volbear=0 ij=1 ind=0 //reset index of array //for ij = 1 to StopLookback do while ij<=StopLookback do j=ij if close[j]>=lrange and close[j]<=hrange then if close[j]>open[j] then volbull=volbull+volume[j] else volbear=volbear+volume[j] endif endif ij=ij+1 wend //next bullbar = round((volbull*StopLookback)/volsum)*scalefactor bearbar = round((volbear*StopLookback)/volsum)*scalefactor if marketEtHeamap=1 then drawrectangle(startbar,lrange,startbar+bullbar,hrange) coloured(46,139,87,alpha)bordercolor(46,139,87,1) drawrectangle(startbar,lrange,startbar+bearbar,hrange) coloured(255,0,0,alpha)bordercolor(250,0,0,1) endif if bullbar>bearbar then RPoc=46 GPoc=139 BPoc=87 else RPoc=255 GPoc=0 BPoc=0 endif if(bullbar>maxbar) then vpoclevel = (lrange+hrange)/2 maxbar=bullbar endif if(bearbar>maxbar) then vpoclevel = (lrange+hrange)/2 maxbar=bearbar endif i=i+1 wend while checkprice<=hh do touch=0 //reset price touch for this price level for i = 0 to StopLookback-1 do if high[i]>=checkprice and low[i]<=checkprice then touch=touch+1 $hm[ind] = touch endif next if $hm[ind] > MaxTouch1 then MaxTouch1 = $hm[ind] MaxTouch2 = checkprice endif //define color CL=(hh+ll)/2 StdDev = (hh- ll) / 2 VX=0.7 VAH=CL + StdDev *vx VAL=CL - StdDev * vx g=rvg b=210 r = min($hm[ind]*12,g) //plot the result //drawtext("█",startbar,checkprice) coloured(r,0,0) if marketEtHeamap=1 then //drawtext("#touch#",startbar-step*3,checkprice) coloured(110,110,110) if sens=1 then drawrectangle(startbar-touch*coef/(1),(checkprice-step/2),startbar,checkprice+step/2)coloured(0,r,50,alpha)bordercolor(210,r,210,50) else drawrectangle(startbar-touch*coef/(-1),(checkprice-step/2),startbar,checkprice+step/2)coloured(0,r,50,alpha)bordercolor(210,r,210,50) endif endif if singlePrint=1 then if touch<=1 then drawrectangle(startbar,checkprice-step/2,Barindex[Conteggio]+box,checkprice+step/2)coloured(110,110,110,alpha)bordercolor(200,r,0,10) endif endif checkprice=checkprice+step //increase price check for next round ind=ind+1 //increase array index wend // Affichage de VAH et VAL //DRAWsegment(startbar, MaxTouch2[1], Barindex[Conteggio]+box, MaxTouch2[1]) coloured(r,0,150,250)style(dottedline,2) DRAWsegment(startbar, vpoclevel, Barindex[Conteggio]+box, vpoclevel) coloured(250,50,0,100)style(line,3) DRAWsegment(startbar, vpoclevel[1], Barindex[Conteggio]+box, vpoclevel[1]) coloured(250,50,0,100)style(dottedline,2) if Poc=1 then bar=startbar-(startbar-Barindex[Conteggio])/2 DRAWsegment(startbar, MaxTouch2, Barindex[Conteggio]+box, MaxTouch2) coloured(250,2500,150,250)style(line,3) DRAWsegment(startbar, VAH, Barindex[Conteggio]+box, VAH) coloured(r,0,150,250)style(line,3) DRAWsegment(startbar, VAL, Barindex[Conteggio]+box, VAL) coloured(r,0,150,250)style(line,3) drawtext("VAH #VAH#",bar,VAH+atr) coloured(110,110,110) drawtext("VAL #VAL#",bar,VAL-atr) coloured(110,110,110) drawrectangle(startbar,hh,Barindex[Conteggio],ll) coloured(0,0,0,1)bordercolor(46,139,87,150)style(DOTTEDLINE ,1) endif if niveaux=1 then yesterdayVPOC=vpoclevel[1] DRAWsegment(startbar, MaxTouch2, Barindex[Conteggio]+box, MaxTouch2) coloured(250,2500,150,250)style(line,3) drawtext(" #DayStop#/#MonthStop# VPOC [#yesterdayVPOC#]",BarIndex,vpoclevel[2],dialog,bold,10) coloured(0,0,0) DRAWTEXT(" #DayStart#/ #MonthStart# Close", barindex+box, PrezzoChiusura+(2*pipsize)) DRAWTEXT(" #DayStart#/ #MonthStart# Open", barindex+box, PrezzoApertura+(2*pipsize)) DRAWTEXT(" #DayStart#/ #MonthStart# High", barindex+box, hh)Coloured(255,0,255) DRAWTEXT(" #DayStart#/ #MonthStart# Low", barindex+box, ll)Coloured(255,0,255) drawrectangle(startbar-1, PrezzoApertura,startbar+1, PrezzoChiusura) coloured(255,55,150,250) bordercolor(210,210,210,50) DRAWARROW (startbar-2, PrezzoApertura) COLOURED (255, 0, 0) DRAWSEGMENT(startbar,PrezzoChiusura,Barindex[Conteggio]+box,PrezzoChiusura) Coloured(255,0,0) DRAWSEGMENT(startbar,PrezzoApertura,Barindex[Conteggio]+box,PrezzoApertura) Coloured(100,75,22) DRAWSEGMENT(startbar,hh,Barindex[Conteggio]+box,hh) Coloured(255,0,255) DRAWSEGMENT(startbar,ll,Barindex[Conteggio]+box,ll) Coloured(255,0,255) //endif endif SelEnd=1 DRAWVLINE(Barindex[Conteggio]) Coloured(255,0,0) ColoreSfondo=1 LastStopBarIndex=barindex //DisegnaLariga endif debutN = 153000 finN = 154500 // TRACE DU RECTANGLE DE L'OPR US IF time = debutN THEN hautN = 0 basN = 0 barredebutN = barindex ENDIF IF time = finN THEN barrefinN = barindex ENDIF IF time >= debutN AND time <= finN THEN IF high > hautN THEN hautN = high ENDIF IF low < basN OR time = debutN THEN basN = low ENDIF difN = round(abs(hautN-basN)) ENDIF if opr=1 then IF time >= finN THEN DrawText(" OPR H #difn#pts",barredebutN,hautN+4*pointsize,Dialog,Bold,10) coloured(0,0,0,250) DrawText(" OPR B",barredebutN,basN+4*pointsize,Dialog,Bold,10) coloured(0,0,0,250) drawsegment(barredebutN,hautN,Barindex[Conteggio],hautN) coloured(0,0,0,50) STYLE (dottedline,2) DRAWRECTANGLE(barredebutN,hautN,barrefinN,basN) coloured(0,0,255,Alpha)bordercolor(0,0,255,Alpha) drawsegment(barredebutN,basN,Barindex[Conteggio],basN) coloured(0,0,0,50) STYLE (dottedline,2) ENDIF endif // heures de session debut = 010000 fin = 090000 // TRACE DU RECTANGLE DE SESSION ASIATIQUE IF time = debut THEN haut = 0 bas = 0 barredebut = barindex ENDIF IF time = fin THEN barrefin = barindex ENDIF IF time >= debut AND time <= fin THEN IF high > haut THEN haut = high ENDIF IF low < bas OR time = debut THEN bas = low ENDIF dif = round(abs(haut-bas)) ENDIF if Asiatic=1 then IF time >= fin THEN DrawText(" Haut asiatique #dif#pts",barredebut,haut+4*pointsize,Dialog,Bold,10) coloured(0,0,0,250) DrawText(" Bas asiatique",barredebut,bas+4*pointsize,Dialog,Bold,10) coloured(0,0,0,250) drawsegment(barredebut,haut,Barindex[Conteggio],haut) coloured(0,0,0,50) STYLE (dottedline,2) DRAWRECTANGLE(barredebut,haut,barrefin,bas) coloured(255,255,0,50)bordercolor(255,255,0,1) drawsegment(barredebut,bas,Barindex[Conteggio],bas) coloured(0,0,0,50) STYLE (dottedline,2) ENDIF endif if IsLastBarUpdate then For j = 1 To nb do for i = 1 To StopLookback-1 do IF High[StopLookback*(j-1)+i]=hh[(j-1)*StopLookback] Then //hh=High[StopLookback*(j-1)+i] HighestI = BarIndex[StopLookback*(j-1)+i] DRAWTEXT(hh[(j-1)*StopLookback], HighestI, hh[(j-1)*StopLookback]+15, Dialog, Standard, 12) COLOURED(0,255,0) DRAWARROWDOWN(HighestI,hh[(j-1)*StopLookback]+2) COLOURED(0,255,00) endif IF Low[StopLookback*(j-1)+i]=ll[(j-1)*StopLookback] Then //ll=Low[StopLookback*(j-1)+i] LowestI = BarIndex[StopLookback*(j-1)+i] DRAWTEXT(ll[(j-1)*StopLookback], LowestI, ll[(j-1)*StopLookback]-15, Dialog, Standard, 12) COLOURED(200,0,0) DRAWARROWUP(LowestI,ll[(j-1)*StopLookback]-2) COLOURED(255,0,00) endif next next endif // TRACE DU RECTANGLE IB IF time = debutL THEN hautL = 0 basL = 0 barredebutL = barindex ENDIF IF time = finL THEN barrefinL = barindex ENDIF IF time >= debutL AND time <= finL THEN IF high > hautL THEN hautL = high ENDIF IF low < basL OR time = debutL THEN basL = low ENDIF difL = round(abs(hautL-basL)) ENDIF if imbalance=1 then if time=IB then barIB=barindex endif IF time >= finL THEN DrawText("Haut Imbalance #difL#pts",barIB+40,hautL+0.4,Dialog,Bold,10) coloured(0,0,0,250) DrawText("Bas Imbalance",barIB+40,basL+0.4,Dialog,Bold,10) coloured(0,0,0,250) drawsegment(barIB,hautL,Barindex[Conteggio],hautL) coloured(0,255,0,Alpha) STYLE (dottedline,1) DRAWRECTANGLE(barIB-1,hautL,barIB+1,basL) coloured(250,255,0,Alpha)bordercolor(0,255,0,1) drawsegment(barIB,basL,Barindex[Conteggio],basL) coloured(0,255,0,Alpha) STYLE (dottedline,1) drawrectangle(barredebutL, hautL,barrefinL, basL) coloured(255,255,150,60) bordercolor(210,210,210,50) ENDIF endif RETURN MaxTouch2,VAH,VAL |
Share this
No information on this site is investment advice or a solicitation to buy or sell any financial instrument. Past performance is not indicative of future results. Trading may expose you to risk of loss greater than your deposits and is only suitable for experienced investors who have sufficient financial means to bear such risk.
ProRealTime ITF files and other attachments :PRC is also on YouTube, subscribe to our channel for exclusive content and tutorials
Very good work. Thanks for sharing
Très joli mais sans mode d’emploi
inexploitable
Pas sympa 🙁
Bonsoir Larouedegann et à l’ensemble de notre communauté,
Nous nous trouvons sur Prorealcode, un espace dédié au partage gratuit où chaque membre de la communauté peut bénéficier des idées et contributions de tous. la plateforme est animée par un esprit de partage, de convivialité et de bienveillance, valeurs qui constituent le cœur de notre engagement collectif.
Chaque utilisateur est invité à explorer et à utiliser les divers programmes disponibles, en y apportant sa touche personnelle. Nous encourageons donc, mesdames et messieurs, votre participation active : à vos programmes, et longue vie à ProRealCode !
Pour ceux parmi vous qui recherchent des programmes accompagnés de modes d’emploi détaillés ou d’autres fonctionnalités spécifiques, Marketplace constitue une option plus adaptée à vos besoins.
Je vous souhaite à tous une excellente fin de journée.
Cordialement,
Philippe.
Bonjour , merci pour le partage GRATUIT . Je voudrais vous demander comment adapter ce Marketprofile aux horaires Europe , OPR , pré-market , ….Exemple pour le DAX . Merci pour votre réponse et pour tous vos partages . Salutations .
Bonjour, OPR pour Moi serait de 9h à 9h15 et tu d’accords avec ce créneau?
Bonsoir , donc OPR = 9h00 a 9h15 et IB = 8h00 a 9h00 , que je dois changer a l’intérieur du programme . ( Début L , Fin L ) ? Merci pour votre réponse . Salutation .
voici pour toi,
1-//defparam drawonlastbaronly=true
2-//HourStart=1
3-//HourStop=23
4-starttimeUS = 090000
5-endtimeUS = 091500
6-IB=010000
7-atr=AverageTrueRange[14](close)
8-dataOggi=date
9-debutL = 080000
10-finL = 090000
260-debutN = 090000
261-finN = 091500
Bonsoir . SUPER , merci beaucoup , c’est très sympa a vous . Salutations .
Bonjour, merci beaucoup pour ce partage. Je vais regarder avec attention ce script et analyser comment l’intégrer dans mes setup. Au top
Bonjour , super taf!! serait il possible de faire un poc dynamique en timeframe 5 min en modifiant quelques parametres?
voici ce qu’il faudrait faire ou ajouter:
//poc dynamique
defparam calculateonlastbars=1000
HourStart=SesStart //15
HourStop=SesStop //23
//pocdefinition=10
//SesShow=1
Compteur=0
once CompteurPoc=0
once SelEnd=0
once SelStart=0
once SesRTH=0
once SesETH=0
once ColoreSfond=0
Compteur=Compteur+1
BarTemps=openhour[Compteur]//OraBarra
if BarTemps=HourStart and SelStart=0 then //Début de la session
SelStart=1
SelEnd=0
SesRTH=1
SesETH=0
CompteurPoc=0
if SesShow=1 then
ColoreSfond=1
DRAWVLINE(Barindex[Compteur])Coloured(0,100,0)
endif
endif
if BarTemps=HourStop and SelEnd=0 then
SelStart=0
SelEnd=1
SesETH=1
SesRTH=0
CompteurPoc=0
if SesShow=1 then
ColoreSfond=0
DRAWVLINE(Barindex[Compteur])Coloured(0,100,0)
endif
endif
ScaleFactor=3
NbrBars=POCDefinition
if ColoreSfond=1 then
BACKGROUNDCOLOR(255,0,0,5)
endif
if SesRTH=1 or SesETH=1 then
CompteurPoc=CompteurPoc + 1
lookback=CompteurPoc
hh=highest[lookback](high)
ll=lowest[lookback](low)
div = (hh-ll)/NbrBars
i=0
volsum=summation[lookback](volume)
maxbar = 0
while i=lrange and close[j]open[j] then
volbull=volbull+volume[j]
else
volbear=volbear+volume[j]
endif
endif
next
bullbar = round((volbull*lookback)/volsum)*scalefactor
bearbar = round((volbear*lookback)/volsum)*scalefactor
//VPOC
if(bullbar>maxbar) then
vpoclevel = (lrange+hrange)/2
maxbar=bullbar
endif
if(bearbar>maxbar) then
vpoclevel = (lrange+hrange)/2
maxbar=bearbar
endif
i=i+1
wend
if opentime=>SesStart then
DRAWSEGMENT(barindex, vpoclevel, barindex[1], vpoclevel[1])
endif
rgbA=0
rgbB=0
rgbC=0
if SesRTH=1 then
rgbA=138
rgbB=43
rgbC=226
else
rgbA=255
rgbB=69
rgbC=0
endif
endif
return //vpoclevel
Merci beaucoup
vraiment beau boulot, j’adore je m’en sert régulièrement