opening range
Forums › ProRealTime English forum › ProBuilder support › opening range
- This topic has 26 replies, 4 voices, and was last updated 6 years ago by Marius.
Tagged: drawsegment, range
-
-
11/17/2018 at 2:36 PM #85110
I thought it could have been an obsolete version.
Sorry. Try asking PRT.
11/19/2018 at 3:11 PM #8519011/19/2018 at 6:55 PM #85204Roberto,
I am embarrassed to ask your help again because I have nothing to give back in return but I ask anyway, hoping for your goodwill.
I do not know how to write code for drawing a line. For example, I would like to have an option to draw automatically a horizontal line at the high, or low, of a, by me selected, 15 minute candle. I spend a lot of time to figure it out bud I cannot fix it and probably for you it is simple.
If it is unclear please do not hesitate to let me know.
Warmest regards and looking forward to hearing from you,
Mert
11/19/2018 at 7:27 PM #85208Like I dis in my first answer, when I drew two segments from X1 to X2 which are the number of the bars to begin and end drawing, and from Y1 to Y2 which is the price level where you want the line to be drawn.
Using the search box for DRAWSEGMENT, DRAWLINE, DRAWVLINE, DRAWHLINE you’ll fine many examples and documentation.
This is an example (https://www.prorealcode.com/documentation/drawhline/):
12345678DEFPARAM DrawOnLastBarOnly = trueIF time = 100000 THENMassimo = highest[2](high)Minimo = lowest[2](low)ENDIFDRAWHLINE(Massimo) COLOURED(0,255,0,255)DRAWHLINE(Minimo) COLOURED(0,255,0,255)RETURNIf you remove or comment out line 1 you’ll understand what use it is.
11/19/2018 at 7:47 PM #85211I have managed to add the lines to my target candle. Its great. The only issue is that I need the line to START at the candle and draw, lets say 4 candles in the future. Does this have something to do with massimo and minimo? Or do I change something else.
11/19/2018 at 8:01 PM #85213Look at my first reply or documentation.
Use barindex to determine the two points, then use any price level at which you want the line to be drawn,
11/21/2018 at 1:40 PM #85409Hi Roberto,
Thank you for that “First hour BO” script. I was used to draw the manually into my chart – so this is way smarter 🙂
I do trade Dax and I would like to have two “First hours” in my chart. First hour of the Future market (8.00 – 9.00) and Dax Kassa (9.00-10.00) and (if possible) fill the upper two lines of the highs with a colour and the lower two lines with another colour – that should give me a zone of future and kassa first hour. See attached screenshot which is a mix of your script and manually drawn.
Can you help me?
Best regards!
11/21/2018 at 4:47 PM #85433There you go:
12345678910111213141516171819202122232425DEFPARAM CalculateOnLastBars = 1000DEFPARAM DrawOnLastBarOnly = TrueIF IntraDayBarIndex = 0 THENMax1 = 0Max2 = 0Min1 = 999999Min2 = 999999BarID = 0ENDIFIF OpenHour = 08 THENIF BarID = 0 THENBarID = BarIndexENDIFMax1 = max(high,Max1)Min1 = min(low,Min1)ENDIFIF OpenHour = 09 THENMax2 = max(high,Max2)Min2 = min(low,Min2)ENDIFIF time >= 100000 AND time <= 230000 THENDRAWRECTANGLE(BarID,Max1,barindex,Max2) coloured(255,0,0,255)DRAWRECTANGLE(BarID,Min1,barindex,Min2) coloured(0,255,0,255)ENDIFRETURNrectangles cannot be coloured other than the default color (only PRT can do that when you draw them manually on the chart), only the border color can be changed.
11/21/2018 at 5:23 PM #8543411/22/2018 at 12:32 PM #85480Hi Roberto,
i might have an issue that I do not understand. The “Breakout” script (08.00 to 09.00 o´clock) works fine BUT it starts to count with the 07.55 candle. The real high of the first hour indeed was the candle that I pointed to with a black arrow. The low is displayed correctly, as the script measures the low of the 08.55 candle.
You have any idea why the fist candle is conted at 07.55 in this 5-Minute-chart?
Best regards!
123456789101112131415161718//DEFPARAM DrawOnLastBarOnly = trueDEFPARAM CalculateOnLastBars = 1000IF time <= 080000 THENhh = 0ll = 999999ENDIFIF time = 080000 THENMyBar = barindexENDIFIF time >= 080000 AND time <= 090000 THENhh = max(hh,high)ll = min(ll,low)ENDIFIF time >= 100000 AND time <= 220000 THENDRAWSEGMENT(MyBar,hh,barindex,hh) COLOURED(0,104,139,255)DRAWSEGMENT(MyBar,ll,barindex,ll) COLOURED(205,0,0,255)ENDIFRETURN11/22/2018 at 12:47 PM #85484To write code, please use the <> “insert PRT code” button to make code easier to read. Thank you.
It is due to the use of TIME, which refers to the current time when each candle closes (just before the next one opens). Use OPENTIME, instead, to achieve what you want
123456789101112131415161718//DEFPARAM DrawOnLastBarOnly = trueDEFPARAM CalculateOnLastBars = 1000IF opentime <= 080000 THENhh = 0ll = 999999ENDIFIF opentime = 080000 THENMyBar = barindexENDIFIF opentime >= 080000 AND opentime <= 090000 THENhh = max(hh,high)ll = min(ll,low)ENDIFIF opentime >= 100000 AND opentime <= 220000 THENDRAWSEGMENT(MyBar,hh,barindex,hh) COLOURED(0,104,139,255)DRAWSEGMENT(MyBar,ll,barindex,ll) COLOURED(205,0,0,255)ENDIFRETURN1 user thanked author for this post.
11/22/2018 at 12:56 PM #85487 -
AuthorPosts
Find exclusive trading pro-tools on