High/Low/Close previous day with time
Forums › ProRealTime English forum › ProBuilder support › High/Low/Close previous day with time
- This topic has 33 replies, 8 voices, and was last updated 2 years ago by Tom.J.
-
-
10/26/2021 at 9:44 AM #180358
Still having trouble with this unfortunately, Roberto. The code pinpoints the previous day’s High, Low and Close just fine, but not the Open. I have compared both versions of the code with
123CurH = openCurL = openCurO = openin lines 18-20 as per your original and also
123CurH = highCurL = lowCurO = closebut neither seems to work, as you can see from the screenshot (Germany 40 – today and yesterday). The code pegs the previous day’s Open at 15,546.3, but you can clearly see from the big red candle at 0800 yesterday it was more like 15,579. Is there an easier way to do this with arrays? Just thinking out loud…
Thanks again for your help on this.
10/28/2021 at 11:26 AM #180461It’s due to IG having set the closing of the Daily candle at 00:00 (Utc +1 +DST). Currently it’s at 01:00.
At 00:00 the date and time is updated on the platform, but the broker reports the previous day till day change at 01:00.
Replace
1IF OpenDay <> OpenDay[1] THENby
1IF (OpenTime = 000000) OR ((OpenTime > 000000) AND (OpenTime[1] > OpenTime)) THEN1 user thanked author for this post.
10/28/2021 at 5:12 PM #18048210/28/2021 at 7:44 PM #180494Use this line:
1IF (OpenTime = 080000) THEN10/29/2021 at 9:43 AM #18052410/29/2021 at 10:02 AM #180531Please post the code you are using and your conditions, as they may be quite different from the original code.
10/29/2021 at 10:21 AM #180533Sure, I have doubled up on the code to give me the OHLC levels for two different sessions simultaneously:
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172ONCE FromD = 080000dCond = (OpenDayOfWeek >= 1 AND OpenDayOfWeek <= 5)//////////////////////////////// Cash session 1 (8.00am-4.35pm)ONCE ToD1 = 163000ONCE CurO1 = openONCE PrevO1 = openONCE CurH1 = highONCE PrevH1 = highONCE CurL1 = lowONCE PrevL1 = lowONCE CurC1 = closeONCE PrevC1 = closetCond1 = OpenTime >= FromD AND OpenTime <= ToD1IF OpenTime = FromD THENPrevO1 = CurO1PrevH1 = CurH1PrevL1 = CurL1PrevC1 = CurC1CurO1 = openCurH1 = openCurL1 = open// CurC1 = closeENDIFIF dCond AND tCond1 THENIF CurL1 = CurO1 THENCurH1 = highCurL1 = lowENDIFCurH1 = max(CurH1,high)CurL1 = min(CurL1,low)CurC1 = closeENDIF//////////////////////////////// Cash session 2 (8.00am-9.00pm)ONCE ToD2 = 205500ONCE CurO2 = openONCE PrevO2 = openONCE CurH2 = highONCE PrevH2 = highONCE CurL2 = lowONCE PrevL2 = lowONCE CurC2 = closeONCE PrevC2 = closetCond2 = OpenTime >= FromD AND OpenTime <= ToD2IF OpenTime = FromD THENPrevO2 = CurO2PrevH2 = CurH2PrevL2 = CurL2PrevC2 = CurC2CurO2 = openCurH2 = openCurL2 = open// CurC2 = closeENDIFIF dCond AND tCond2 THENIF CurL2 = CurO2 THENCurH2 = highCurL2 = lowENDIFCurH2 = max(CurH2,high)CurL2 = min(CurL2,low)CurC2 = closeENDIFRETURN PrevO1 coloured(255,140,0) STYLE(line,3) AS "Previous day Open 4.35pm", PrevH1 coloured(0,0,255,255) STYLE(line,3) AS "Previous day High 4.35pm", PrevL1 coloured(0,0,255,255) STYLE(line,3) AS "Previous day Low 4.35pm", PrevC1 coloured(0,0,0) STYLE(line,3) AS "Previous day Close 4.35pm", PrevO2 coloured(255,180,0) STYLE(line,1) AS "Previous day Open 9.00pm", PrevH2 coloured(50,50,255,255) STYLE(line,1) AS "Previous day High 9.00pm", PrevL2 coloured(50,50,255,255) STYLE(line,1) AS "Previous day Low 9.00pm", PrevC2 coloured(50,50,50) STYLE(line,1) AS "Previous day Close 9.00pm"10/29/2021 at 11:04 AM #180538Hi guys,
Will you be so kind to make an indicator that shows:
high (blue) / low (blue) / close (yellow) of the previous day
with Monday showing the previous Friday
with time setting (for example from 09.00 – 17.35 hours)
for use in intraday charts
Thank you in advance!
SMP – Would this be of use. I am waiting for this to be uploaded into the library. It’s an EOD (End of day) Cash Market Pivots Indicator!
10/29/2021 at 11:29 AM #180541I changed the colouring so that at the beginning od the evening session, the prior session is no longer visible (is this what you wanted?).
As to time change, I can’t spot any glitch:
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677ONCE FromD = 080000dCond = (OpenDayOfWeek >= 1 AND OpenDayOfWeek <= 5)//////////////////////////////// Cash session 1 (8.00am-4.35pm)ONCE ToD1 = 163000ONCE CurO1 = openONCE PrevO1 = openONCE CurH1 = highONCE PrevH1 = highONCE CurL1 = lowONCE PrevL1 = lowONCE CurC1 = closeONCE PrevC1 = closetCond1 = OpenTime >= FromD AND OpenTime <= ToD1IF OpenTime = FromD THENt = 255PrevO1 = CurO1PrevH1 = CurH1PrevL1 = CurL1PrevC1 = CurC1CurO1 = openCurH1 = openCurL1 = open// CurC1 = closeENDIFIF dCond AND tCond1 THENIF CurL1 = CurO1 THENCurH1 = highCurL1 = lowENDIFCurH1 = max(CurH1,high)CurL1 = min(CurL1,low)CurC1 = closeENDIF//////////////////////////////// Cash session 2 (8.00am-9.00pm)ONCE ToD2 = 205500ONCE CurO2 = openONCE PrevO2 = openONCE CurH2 = highONCE PrevH2 = highONCE CurL2 = lowONCE PrevL2 = lowONCE CurC2 = closeONCE PrevC2 = closetCond2 = OpenTime >= FromD AND OpenTime <= ToD2IF OpenTime = FromD THENPrevO2 = CurO2PrevH2 = CurH2PrevL2 = CurL2PrevC2 = CurC2CurO2 = openCurH2 = openCurL2 = open// CurC2 = closeENDIFIF dCond AND tCond2 THENIF CurL2 = CurO2 THENCurH2 = highCurL2 = lowENDIFCurH2 = max(CurH2,high)CurL2 = min(CurL2,low)CurC2 = closeENDIFIF OpenTime >= ToD1 THENt = 0ENDIFRETURN PrevO1 coloured(255,140,0,t) STYLE(line,3) AS "Previous day Open 4.35pm", PrevH1 coloured(0,0,255,t) STYLE(line,3) AS "Previous day High 4.35pm", PrevL1 coloured(0,0,255,t) STYLE(line,3) AS "Previous day Low 4.35pm", PrevC1 coloured(0,0,0,7) STYLE(line,3) AS "Previous day Close 4.35pm", PrevO2 coloured(255,180,0) STYLE(line,1) AS "Previous day Open 9.00pm", PrevH2 coloured(50,50,255,255) STYLE(line,1) AS "Previous day High 9.00pm", PrevL2 coloured(50,50,255,255) STYLE(line,1) AS "Previous day Low 9.00pm", PrevC2 coloured(50,50,50) STYLE(line,1) AS "Previous day Close 9.00pm"10/29/2021 at 11:53 AM #180547Thanks, Roberto. I hadn’t thought of that design element, but that’s actually very helpful. There are only two outstanding issues as far as I can see:
- The indicator now does not show the Previous day Close @ 1635 as per the attached screenshot.
- It appears that, in order for the code to use the correct bars for the end of the session, you have to use the time of the bar close one before the desired session end time (so in this case 163000 instead of 163500 and 205500 instead of 210000), which means the thicker lines stop one bar (in this case – on a 5-min timeframe – 5 mins) early. Any way of remedying this?
Thanks again,
JM
10/29/2021 at 4:58 PM #180562My bad…I wrote 7 instead of t in line 77.
PrevC1 coloured(0,0,0,7) should read PrevC1 coloured(0,0,0,t).
1 user thanked author for this post.
11/17/2022 at 10:49 AM #204310Hello
Thanks for this code.
I understand how to adjust so it shows the high and low from all the day (midnight to midnight).
But what I would like some help with is this: I would like the script to print the high and low from the previous day according to a specific timezone (NY-timezone, which my PRT are set to). Now I think it takes the high and low from the daily candle.
Thanks for any help!
11/17/2022 at 12:27 PM #204319If you want to track and display end-of-day (EOD) pivots on cash markets, you CAN NOT do this using coding and measuring last-day high/low etc. You cannot do this automatically because the real close is determined in the “settling period”, which, depending on the cash market you are trading, is between 5 minutes and 12 minutes. During this period, a price is determined and set in this period.
These are the accurate pivots and are used by institutions and professional traders. Take it from a pro-trader; you are wasting time trying to automate using chart data. Also, depending on the broker (Take IG as an example), they have a 24-hour market and “make” the market so a user can trade “out of hours”, so their candles at the close are not accurate.
I have shared an EOD pivot indicator, which is correct and works on all cash markets.
You are wasting your time automating pivots that are not correct.
I hope this helps.
Steve
11/17/2022 at 1:35 PM #204330Thanks for yout reply.
I dont want to track eod data on cash markets. I am trading fx and want to track high and low of previos day (which I define as NY midnight to midnight). I see now the original question was in regards to cash markets, hence the confusion I think.
11/21/2022 at 12:47 PM #204561Is this what you want?
1234567891011121314ONCE NYtime = 060000ONCE CurH = highONCE PrevH = highONCE CurL = lowONCE PrevL = lowIF (OpenTime = NYtime) OR ((OpenTime > NYtime) AND (OpenTime[1] < NyTime)) THENPrevH = CurHPrevL = CurLCurH = highCurL = lowENDIFCurH = max(high,CurH)CurL = min(low,CurL)RETURN PrevH coloured("Blue") AS "Previous DAY high",PrevL coloured("Red") AS "Previous DAY low"1 user thanked author for this post.
-
AuthorPosts
Find exclusive trading pro-tools on