ADR to show on Intraday
Forums › ProRealTime English forum › ProBuilder support › ADR to show on Intraday
- This topic has 8 replies, 3 voices, and was last updated 2 years ago by JC_Bywan.
-
-
06/28/2022 at 2:13 PM #196307
I will like to view this Daily ADR calcualation in Intraday time frame. Please help code
defparam drawonlastbaronly=true
P = 10AVH = average[p](high)
AVL= average[p](low)
ADR =AVH -AVLL0=(Dlow(0) )
R75=L0+(ADR*.75)
R50=L0+(ADR*.50)drawtext(“R75”,barindex,R75)
drawtext(“R50”,barindex,R50)
drawtext(“L0”,barindex,L0)06/28/2022 at 4:33 PM #196329Hello,
here it is, with small horizontal segments added and text shifted a little bit to the right:
123456789101112131415161718192021222324defparam drawonlastbaronly=trueP = 10somme=0for i=0 to p-1somme=somme+Dhigh(i)-Dlow(i)nextADR=somme/pL0=Dlow(0)R75=L0+(ADR*.75)R50=L0+(ADR*.50)drawtext("R75", barindex+15, R75)drawtext("R50", barindex+15, R50)drawtext("L0", barindex+15, L0)DRAWSEGMENT(barindex, R75, barindex+10, R75)DRAWSEGMENT(barindex, R50, barindex+10, R50)DRAWSEGMENT(barindex, L0, barindex+10, L0)return1 user thanked author for this post.
06/28/2022 at 7:14 PM #19634406/30/2022 at 7:33 AM #196420Good morning. Is it possible to code a Weekly ADR calculation in Intraday time frame. Thanks in advance
defparam drawonlastbaronly=trueP = 10somme=0for i=0 to p–1somme=somme+Dhigh(i)–Dlow(i)nextADR=somme/pL0=Dlow(0)R75=L0+(ADR*.75)R50=L0+(ADR*.50)drawtext(“R75”, barindex+15, R75)drawtext(“R50”, barindex+15, R50)drawtext(“L0”, barindex+15, L0)DRAWSEGMENT(barindex, R75, barindex+10, R75)DRAWSEGMENT(barindex, R50, barindex+10, R50)DRAWSEGMENT(barindex, L0, barindex+10, L0)return06/30/2022 at 12:49 PM #196465ADR12345678910111213141516DefParam DrawOnLastBarOnly = TrueTimeFrame(Daily)ADR = RangeADRLow = LowAvgADR = Average[10](ADR)ADR50 = ADRLow + 0.5 * AvgADRADR75 = ADRLow + 0.75 * AvgADRTimeFrame(Default)drawtext("ADR75", barindex, ADR75+10) Coloured(0,255,0)drawtext("ADR50", barindex, ADR50+10) Coloured(0,0,255)drawtext("ADRLow", barindex, ADRLow+10) Coloured(255,0,0)Return ADR50 as "ADR50" Coloured(0,0,255), ADR75 as "ADR75" Coloured(0,255,0), ADRLow as "ADRLow" Coloured(255,0,0)Hi @oyinloyea
Here is an alternative with MTF.
If you want to use weekly rates, you can change “TimeFrame(Daily)” to TimeFrame(Weekly)…
1 user thanked author for this post.
09/24/2022 at 3:40 PM #201301Using the above style of coding labels are not showing on my chart when using Timeframe Weekly
DefParam DrawOnLastBarOnly = True
DEFPARAM CalculateOnLastBars = 1000
Voffset = -5*pipsize
TimeFrame(Weekly)ADR = Range
//L0 =DLow(0)
L0 = Low
L0=L0
//H0 =DHigh(0)
H0 =High
H0=H0
AvgADR = Average[10](ADR)
S125= H0- 1.25 * AvgADR
S100= H0 – 1 * AvgADR
S75=H0- .75 * AvgADR
S50=H0- .50 * AvgADR
Mid= (H0+L0)/2drawtext(“S125”,barindex,S125+Voffset,SansSerif,Bold,10)
drawtext(“S100”,barindex,S100+Voffset,SansSerif,Bold,10)
drawtext(“S75”,barindex,S75+Voffset,SansSerif,Bold,10)
drawtext(“S50”,barindex,S50+Voffset,SansSerif,Bold,10)
drawtext(“H0”,barindex,H0+Voffset,SansSerif,Bold,10)
drawtext(“L0”,barindex,L0+Voffset,SansSerif,Bold,10)
drawtext(“Mid”,barindex,Mid+Voffset,SansSerif,Bold,10)DRAWSEGMENT(barindex, S125, barindex+10, S125)coloured(0,153,0)
DRAWSEGMENT(barindex, S100, barindex+10, S100)coloured(0,153,0)
DRAWSEGMENT(barindex, S75, barindex+10, S75)coloured(0,153,0)
DRAWSEGMENT(barindex, S50, barindex+10, S50)coloured(0,153,0)
DRAWSEGMENT(barindex, mid, barindex+10, mid)
DRAWSEGMENT(barindex, H0, barindex+10, H0)
DRAWSEGMENT(barindex, L0, barindex+10, L0)
RETURN L0 as “Low”,H0 as “High”,S125 AS “S125”, S100 AS “S100”, S75 AS “S75” , S50 AS “S50”, mid as “mid”09/24/2022 at 3:58 PM #201302That’s because from JS’s code above you only took timeframe(weekly) and for some reason deleted the timeframe(default) line (see his line 11 before the drawtext labels lines). You would need to place it back to see your labels, in between your Mid= (H0+L0)/2 line and your drawtext(“S125”… line
1 user thanked author for this post.
09/25/2022 at 3:00 PM #201366I am trying to code this as an indicator
AvgRange= Average((H-L),10
NarrowRange= AvgRange*.65
AdvanvcesdADR=((H-L),Periods
Wide Range= Avg Range * 1.25
This is what I have but I think it is incorrect. Please help
1234567891011121314151617181920212223242526defparam drawonlastbaronly=trueAVR= (High-Low)[p]WR=AVR *1.25NR=AVR *.65ADADR= (High-Low)If ADADR > WR thenr=255g=0b=0endifIf ADADR > NR and ADADR < WR thenr=0g=0b=255endifIf ADADR < NR thenr=204g=204b=0endifreturn ADADR coloured(r,g,b) style(histogram),AVR as “AVR” , WR as “WR”, NR as “NR”09/27/2022 at 9:49 AM #201473Although on one hand I guess AvgRange= Average((H-L),10 in whatever programming language that was, would probably be in probuilder language:
AvgRange= Average[10](H-L)
on the other hand I do not know what AdvanvcesdADR=((H-L),Periods would be, this is not a programming language I can help with, sorry
-
AuthorPosts
Find exclusive trading pro-tools on