The code fetch the opening, highest, lowest, and closing prices of the selected instrument for the “Nb” previous days.
The dashboard will calculate the percentage change in the instrument’s closing price compared to the previous day’s close.
Values are displayed as a dashboard on your chart, adapt the way it is displayed by moving it with X and Y coordinates in pixels.
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 |
defparam drawonlastbaronly=true // ----settings------ Start=20240131 Alpha=50 X=1 Y=1 Nb=5 //days quantity // ------------------ NbDeJour =nb// Nombre de jours à ajouter timeframe(daily) if opendate=start then d1=Openday mm1=Openmonth y1=OpenYear startbar=barindex dernier=close ouverture=open PlusHaut=high plusBas=low for j=1 to Nb do $d2[j]=Openday[j-1] $v[j]=volume[j-1] $variation1[j]=(round(Variation(close[j-1]),2)) next endif timeframe(default) // Calcul pour ajouter NbDeJour à la barre de début // Dessine une ligne verticale à la nouvelle date DRAWVLINE(startbar) drawrectangle(X-205,50+Y,1105+X,15+Y)anchor(bottomleft)coloured(100,150,10,alpha)bordercolor(200,150,10,250) drawrectangle(X-205,80+Y,1105+X,50+Y)anchor(bottomleft)coloured(200,150,10,alpha)bordercolor(200,150,10,200) drawsegment(x-50,80+Y,x-50,15+Y)anchor(bottomleft)coloured(200,150,10,250)style(line,4) drawsegment(150+x,80+Y,150+X,15+Y)anchor(bottomleft)coloured(200,150,10,250)style(line,4) drawsegment(350+x,80+Y,350+X,15+Y)anchor(bottomleft)coloured(200,150,10,250)style(line,4) drawsegment(550+x,80+Y,550+X,15+Y)anchor(bottomleft)coloured(200,150,10,250)style(line,4) drawsegment(750+x,80+Y,750+X,15+Y)anchor(bottomleft)coloured(200,150,10,250)style(line,4) drawsegment(920+x,80+Y,920+X,15+Y)anchor(bottomleft)coloured(200,150,10,250)style(line,4) //DRAWTEXT(" #d1#/#mm1#/ #y1#", x-150, 30+y,Dialog,Bold,18) anchor(bottomleft) drawtext ("Date", x-150 ,60+y,Dialog,Bold,30) anchor(bottomleft) drawtext ("Dernier", 50+x ,60+y,Dialog,Bold,30) anchor(bottomleft) drawtext ("ouverture", 250+x ,60+y,Dialog,Bold,30) anchor(bottomleft) drawtext ("Plus haut", 450+x ,60+y,Dialog,Bold,30) anchor(bottomleft) drawtext ("Plus bas", 650+x ,60+y,Dialog,Bold,30) anchor(bottomleft) drawtext ("volume", 840+x ,60+y,Dialog,Bold,30) anchor(bottomleft) drawtext ("variation %", 1020+x ,60+y,Dialog,Bold,30) anchor(bottomleft) dist=60 dist1=10 dist2=30 d2=1 der=0 startbarPlusNbDeJour = startbar + NbDeJour for i=1 TO nb do if i=1 then der=dernier ouv=ouverture hh=PlusHaut ELSE der=dclose(i) ouv=dopen(i) hh=dhigh(i) ll=dlow(i) endif if $variation1[i]<0 THEN r=250 b=0 g=0 ELSE r=0 b=110 g=10 endif startbar1 =barindex+i //mm1=Openmonth //y1=OpenYear dist=dist-30 dist1=dist1-30 dist2=dist2-1 DRAWTEXT(der, 50+x, y+dist,Dialog,Bold,18) anchor(bottomleft) DRAWTEXT(ouv, 250+x, y+dist,Dialog,Bold,18) anchor(bottomleft) DRAWTEXT(hh, 450+x, y+dist,Dialog,Bold,18) anchor(bottomleft) DRAWTEXT(ll, 650+x, y+dist,Dialog,Bold,18) anchor(bottomleft) DRAWTEXT($v[i], 850+x, y+dist,Dialog,Bold,18) anchor(bottomleft) DRAWTEXT($variation1[i], 1000+x, y+dist,Dialog,Bold,18) anchor(bottomleft)coloured(r,b,g,250) DRAWTEXT($d2[i], x-150, y+dist,Dialog,Bold,18) anchor(bottomleft) drawrectangle(X-205,Y+dist1,1105+X,20+Y+dist2)anchor(bottomleft)coloured(100,150,10,alpha)bordercolor(200,150,10,250) next return |
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