Show 5 minute candlestick in 1 minute chart
Forums › ProRealTime English forum › ProBuilder support › Show 5 minute candlestick in 1 minute chart
- This topic has 28 replies, 9 voices, and was last updated 1 year ago by LucasBest.
-
-
07/08/2020 at 3:45 PM #13876007/08/2020 at 4:52 PM #13877207/08/2020 at 7:16 PM #13877807/08/2020 at 11:42 PM #138797
This is an indicator that does what you are asking, but plots the 5-minute bar when ALL 5 1-minute bars have closed.
This is for v10.3+. If you have access to v11 you can also change the filling colour of the rectangle.
123456789101112131415C5 = closeIf OpenMinute MOD 5 = 0 Then //Reset variables each new 5-minute barO5 = openH5 = highL5 = lowElseH5 = max(H5,high)L5 = min(L5,low)EndifIf OpenMinute MOD 5 = 4 Then //plot only when the 5-minute bar closesDrawrectangle(BarIndex - 4,O5,BarIndex,C5) Coloured(0,255,0,255) //BodyDrawRectangle(BarIndex - 2,max(O5,C5),BarIndex - 2,H5) Coloured(0,255,0,255) //Upper WickDrawRectangle(BarIndex - 2,min(O5,C5),BarIndex - 2,L5) Coloured(0,255,0,255) //Lower WickEndifReturn07/09/2020 at 5:31 AM #1388031234567891011121314151617181920212223242526C5 = closeIf OpenMinute MOD 5 = 0 Then //Reset variables each new 5-minute barO5 = openH5 = highL5 = lowElseH5 = max(H5,high)L5 = min(L5,low)EndifIf c5<o5 thenr=255g=0b=0elser=0g=255b=0endifIf OpenMinute MOD 5 = 4 Then //plot only when the 5-minute bar closesDrawrectangle(BarIndex - 4,O5,BarIndex,C5) Coloured(r,g,b,255) //BodyDrawRectangle(BarIndex - 2,max(O5,C5),BarIndex - 2,H5) Coloured(r,g,b,255) //Upper WickDrawRectangle(BarIndex - 2,min(O5,C5),BarIndex - 2,L5) Coloured(r,g,b,255) //Lower WickEndifReturnHello robertogozzi Thank you very much for your work, I would not have thought of it. I added the color change. Thanks again
07/09/2020 at 9:28 AM #138819in V11, you can now access easily the OHLC values with the ease of the MTF instruction for indicators!
12345678timeframe(5 minutes)open5 = openhigh5 = highlow5 = lowclose5 = closetimeframe(default)//build here your rectangle with the 5-minutes OHLC variables ^1 user thanked author for this post.
07/09/2020 at 9:50 AM #13882003/25/2022 at 12:19 AM #190444Possible to make the Drawrectangle with thicker boarder?
03/25/2022 at 10:40 AM #190464Hi, to make thicker edge on rectangles, add style(line,2) at the end (or 3 for even thicker, 4 or 5 work too, but not 6 and above), example:
1DrawRectangle(BarIndex - 2,max(O5,C5),BarIndex - 2,H5) Coloured(r,g,b,255) style(line,2)1 user thanked author for this post.
07/12/2022 at 7:01 AM #197154Guten MorgenKann wie müsste der Code aussehen wenn Ich im 30 sek Chart die 15 Min Kerze sehen will ?Irgenwie bekomme Ich das nicht hin .Im vorraus Vielen DanGood morning
Can the code look like if I want to see the 15-minute candle in the 30-second chart?
Somehow I can’t do that. In Advance
thank you
07/12/2022 at 7:23 AM #197157Only post in the language of the forumthat you are posting in. For example English only in the English speaking forums and French only in the French speaking forums.
Thank you 🙂
Use Nicolas’code (https://www.prorealcode.com/topic/show-5-minute-candlestick-in-1-minute-chart/#post-138819) and replace 5 minutes with 15.
You can apply it on your preferred timeframe.
1 user thanked author for this post.
07/12/2022 at 7:54 AM #197160Good morning Yes, unfortunately that doesn’t seem to work, but 2 candles are always drawn every 15 minutes
1234567891011121314151617181920212223timeframe(15 minutes)C5 = closeO5 = openH5 = highL5 = lowIf c5<o5 thenr=255g=0b=0elser=0g=255b=0endiftimeframe(default)If OpenMinute MOD 15 = 14 Then //plot only when the 15-minute bar closesDrawrectangle(BarIndex - 28,O5,BarIndex,C5) Coloured(r,g,b,180)style(line,1) //Body /style Line 2 = DickeDrawRectangle(BarIndex - 14,max(O5,C5),BarIndex - 14,H5) Coloured(r,g,b,180)style(line,1) //Upper WickDrawRectangle(BarIndex - 14,min(O5,C5),BarIndex - 14,L5) Coloured(r,g,b,180)style(line,1) //Lower WickEndifReturn07/12/2022 at 10:40 AM #197169That seems to work:
1234567891011121314151617181920212223242526timeframe(15 minutes,updateonclose)ONCE ID = 0ID = ID + 1//C5 = closeO5 = openH5 = highL5 = lowIf c5<o5 thenr=255g=0b=0elser=0g=255b=0endiftimeframe(default)ONCE PlotCandle = 0IF ID <> ID[1] THENDrawrectangle(BarIndex - 29,O5,BarIndex,C5) Coloured(r,g,b,180)style(line,1) //Body /style Line 2 = DickeDrawRectangle(BarIndex - 14,max(O5,C5),BarIndex - 14,H5) Coloured(r,g,b,180)style(line,1) //Upper WickDrawRectangle(BarIndex - 14,min(O5,C5),BarIndex - 14,L5) Coloured(r,g,b,180)style(line,1) //Lower WickENDIFReturn1 user thanked author for this post.
07/13/2022 at 6:13 AM #197196Hi…
Just be aware, the code above, let’s say under a 3-5m timeframe and low market activity, may affect the position of the 15m candle’s . To be more specific the left hand, open side, of the candles body. Since your using this on 30s timeframe the probability of this happening is greatly increased.
However depending on how critical your using it , and if not at time’s of low market activity this is decreased but no totally. And even if it does arise may not be significant to worry about. It may not be a problem to you and you could ignore it but I thought I should mention it.
Unfortunately this doesn’t seem like a quick fix. Recognized problem because I came across it on something I’m still working on.
Though I can’t offer a solution at this time, adding the Line of code below just before RETURN can give indication of when this problem is happening.
The line displays a row of ‘x’ ‘s at the bottom of the indicator panel, if there’s a gap, a missing ‘x’ then the open/left side of the candle will be drawn out of position, to the left, by the number of missing ‘x’ ‘ s underneath that 15m candle’s real position.
1drawtext("x",barindex,6)anchor(bottomLeft,index,yShift)1 user thanked author for this post.
07/13/2022 at 9:57 AM #197208 -
AuthorPosts
Find exclusive trading pro-tools on