Simple script showing values correctly on Daily but not lower TFs
Forums › ProRealTime English forum › ProBuilder support › Simple script showing values correctly on Daily but not lower TFs
- This topic has 16 replies, 3 voices, and was last updated 3 years ago by Nicolas.
-
-
01/21/2021 at 10:21 AM #158797
Hi all,
I’ve a simple “Camarilla Levels” script for PRT. It used to display fine on all timeframes in PRT 10.3 but ever since moving to PRT 11, it shows correctly on daily but wrong values in lower TFs.
Code is below
Cam-Pivots12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152defparam drawonlastbaronly = true//vertical offset to draw text correctly over horizontal lines//Voffset = 5*pipsizeVoffset = 0// -3*pipsizetextloc=barindex//yesterday's valuehighhtf = DHigh(1)lowhtf = DLow(1)closehtf=DClose(1)//Camarilla Pivot PointP = (highhtf + lowhtf + closehtf)/3RP= round(P)DRAWTEXT(" CPiv #RP#",textloc,RP,SansSerif,Bold,11)//coloured(255,0,128)DRAWHLINE(RP)DRange = highhtf - lowhtfH5 = round((highhtf / lowhtf) * closehtf) // Breakout TargetH4 = round(closehtf + DRange * 1.1/2) // Bullish BreakoutH3 = round(closehtf + DRange * 1.1/4) // Sell Reversal//H2 = round(closehtf + DRange * 1.1/6)//H1 = round(closehtf + DRange * 1.1/12)//L1 = round(closehtf - DRange * 1.1/12)//L2 = round(closehtf - DRange * 1.1/6)L3 = round(closehtf - DRange * 1.1/4) // Buy ReversalL4 = round(closehtf - DRange * 1.1/2) // Bearish BreakoutL5 = round(closehtf - (H5 - closehtf)) // Bearish Target//draw pivot points textDRAWTEXT(" BOT-H5 #H5#",textloc,H5+Voffset,SansSerif,Bold,12)coloured(255,0,128)DRAWTEXT(" BBO-H4 #H4#",textloc,H4+Voffset,SansSerif,Bold,12)coloured(0,200,0)DRAWTEXT(" SR-H3 #H3#",textloc,H3+Voffset,SansSerif,Bold,12)coloured(255,0,0)DRAWTEXT(" BR-L3 #L3#",textloc,L3+Voffset,SansSerif,Bold,12)//coloured(0,255,255)DRAWTEXT(" SBD-L4 #L4#",textloc,L4+Voffset,SansSerif,Bold,12)coloured(255,0,128)DRAWTEXT(" BDT-L5 #L5#",textloc,L5+Voffset,SansSerif,Bold,12)coloured(0,255,128)//draw pivot points lines with extensionDRAWSEGMENT(barindex-4,H5,barindex,H5) //coloured(255,0,255)DRAWSEGMENT(barindex-4,H4,barindex,H4) //coloured(255,0,255)DRAWSEGMENT(barindex-4,H3,barindex,H3) //coloured(255,0,255)DRAWSEGMENT(barindex-4,L3,barindex,L3) //coloured(0,255,255)DRAWSEGMENT(barindex-4,L4,barindex,L4) //coloured(0,255,255)DRAWSEGMENT(barindex-4,L5,barindex,L5) //coloured(0,255,255)RETURNAny thoughts what could be the problem here?
Regards
Ash
01/21/2021 at 10:37 AM #158802Indeed, there is sometimes strange behaviour of the code, coming from constants like Dopen or Dlow, I can replicate with the below code:
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051defparam drawonlastbaronly = true//vertical offset to draw text correctly over horizontal lines//Voffset = 5*pipsizeVoffset = 0// -3*pipsizetextloc=barindex//yesterday's valuehighhtf = DHigh(1)lowhtf = DLow(1)closehtf=DClose(1)//Camarilla Pivot PointP = (highhtf + lowhtf + closehtf)/3RP= round(P)DRAWTEXT(" CPiv #RP#",textloc,RP,SansSerif,Bold,11)//coloured(255,0,128)DRAWHLINE(RP)DRange = highhtf - lowhtfH5 = round((highhtf / lowhtf) * closehtf) // Breakout TargetH4 = round(closehtf + DRange * 1.1/2) // Bullish BreakoutH3 = round(closehtf + DRange * 1.1/4) // Sell Reversal//H2 = round(closehtf + DRange * 1.1/6)//H1 = round(closehtf + DRange * 1.1/12)//L1 = round(closehtf - DRange * 1.1/12)//L2 = round(closehtf - DRange * 1.1/6)L3 = round(closehtf - DRange * 1.1/4) // Buy ReversalL4 = round(closehtf - DRange * 1.1/2) // Bearish BreakoutL5 = round(closehtf - (H5 - closehtf)) // Bearish Target//draw pivot points textDRAWTEXT(" BOT-H5 #H5#",textloc,H5+Voffset,SansSerif,Bold,12)coloured(255,0,128)DRAWTEXT(" BBO-H4 #H4#",textloc,H4+Voffset,SansSerif,Bold,12)coloured(0,200,0)DRAWTEXT(" SR-H3 #H3#",textloc,H3+Voffset,SansSerif,Bold,12)coloured(255,0,0)DRAWTEXT(" BR-L3 #L3#",textloc,L3+Voffset,SansSerif,Bold,12)//coloured(0,255,255)DRAWTEXT(" SBD-L4 #L4#",textloc,L4+Voffset,SansSerif,Bold,12)coloured(255,0,128)DRAWTEXT(" BDT-L5 #L5#",textloc,L5+Voffset,SansSerif,Bold,12)coloured(0,255,128)//draw pivot points lines with extensionDRAWSEGMENT(barindex-4,H5,barindex,H5) //coloured(255,0,255)DRAWSEGMENT(barindex-4,H4,barindex,H4) //coloured(255,0,255)DRAWSEGMENT(barindex-4,H3,barindex,H3) //coloured(255,0,255)DRAWSEGMENT(barindex-4,L3,barindex,L3) //coloured(0,255,255)DRAWSEGMENT(barindex-4,L4,barindex,L4) //coloured(0,255,255)DRAWSEGMENT(barindex-4,L5,barindex,L5) //coloured(0,255,255)RETURN highhtf ,lowhtf ,closehtfI will ask what cause this issue, please feel free to launch a suppor ticket with a link to this thread, I’ll do the same. Thanks.
01/21/2021 at 1:16 PM #15882101/21/2021 at 1:29 PM #15882301/22/2021 at 10:33 AM #15889301/25/2021 at 1:18 PM #15939001/28/2021 at 10:44 PM #159746Thanks Nic.
highhtf = DHigh(1)
lowhtf = DLow(1)
closehtf=DClose(1)Just a simple script to display above values will give different results on different time frames. Only daily is returning correct value because above values are Daily based.
02/24/2021 at 3:51 PM #16252702/24/2021 at 4:38 PM #162534I have no idea right now, but a workaround would be to use the daily timeframe to get the OHLC value:
1234timeframe(daily, updateonclose)highhtf = high[1]lowhtf = Low[1]closehtf = Close[1]1 user thanked author for this post.
02/25/2021 at 12:00 PM #162606Thanks a lot Nic.
Everyday is a learning day. I read somewhere Ale mentioning that MTF is there in new version but i was like it is only in scanners. I will be doing all my MTF porting from TV to PRT now. Thanks.
Function timeframe opens many opportunities.
02/25/2021 at 12:15 PM #162607Hi Nic,
I modified the code such as
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354defparam drawonlastbaronly = true//vertical offset to draw text correctly over horizontal lines//Voffset = 5*pipsizeVoffset = 0// -3*pipsizetextloc=barindex//yesterday's valuetimeframe(daily, updateonclose)highhtf = High[1]lowhtf = Low[1]closehtf=Close[1]//Camarilla Pivot PointP = (highhtf + lowhtf + closehtf)/3RP= round(P)DRAWTEXT(" CPiv #RP#",textloc,RP,SansSerif,Bold,11)//coloured(255,0,128)DRAWHLINE(RP)DRange = highhtf - lowhtfH5 = round((highhtf / lowhtf) * closehtf) // Breakout TargetH4 = round(closehtf + DRange * 1.1/2) // Bullish BreakoutH3 = round(closehtf + DRange * 1.1/4) // Sell Reversal//H2 = round(closehtf + DRange * 1.1/6)//H1 = round(closehtf + DRange * 1.1/12)//L1 = round(closehtf - DRange * 1.1/12)//L2 = round(closehtf - DRange * 1.1/6)L3 = round(closehtf - DRange * 1.1/4) // Buy ReversalL4 = round(closehtf - DRange * 1.1/2) // Bearish BreakoutL5 = round(closehtf - (H5 - closehtf)) // Bearish Target//draw pivot points textDRAWTEXT(" BOT-H5 #H5#",textloc,H5+Voffset,SansSerif,Bold,12)coloured(255,0,128)DRAWTEXT(" BBO-H4 #H4#",textloc,H4+Voffset,SansSerif,Bold,12)coloured(0,200,0)DRAWTEXT(" SR-H3 #H3#",textloc,H3+Voffset,SansSerif,Bold,12)coloured(255,0,0)DRAWTEXT(" BR-L3 #L3#",textloc,L3+Voffset,SansSerif,Bold,12)//coloured(0,255,255)DRAWTEXT(" SBD-L4 #L4#",textloc,L4+Voffset,SansSerif,Bold,12)coloured(255,0,128)DRAWTEXT(" BDT-L5 #L5#",textloc,L5+Voffset,SansSerif,Bold,12)coloured(0,255,128)//draw pivot points lines with extensionDRAWSEGMENT(barindex-4,H5,barindex,H5) //coloured(255,0,255)DRAWSEGMENT(barindex-4,H4,barindex,H4) //coloured(255,0,255)DRAWSEGMENT(barindex-4,H3,barindex,H3) //coloured(255,0,255)DRAWSEGMENT(barindex-4,L3,barindex,L3) //coloured(0,255,255)DRAWSEGMENT(barindex-4,L4,barindex,L4) //coloured(0,255,255)DRAWSEGMENT(barindex-4,L5,barindex,L5) //coloured(0,255,255)RETURNThe display is fine on Daily Chart but when I use lower TF charts, it doesn’t display anything.
02/25/2021 at 1:16 PM #162614Because you are not switching to the default timeframe (the one displayed on the chart) in the code, add this line below line 13:
1timeframe(default)so all the below code will be read and used on the current timeframe displayed.
1 user thanked author for this post.
02/25/2021 at 2:26 PM #162622I did that but it displays different values on 1D chart, and different values on lower timeframes charts but all lower timeframes have same values. i.e.
values of 1D isn’t equal to values from 4h/2h/1h/30/15m while (4h=2h=1h=30m=15m)
02/26/2021 at 9:09 AM #16266402/26/2021 at 11:37 AM #162673 -
AuthorPosts
Find exclusive trading pro-tools on