Intraday Stats During Opening Hours
Forums › ProRealTime English forum › ProRealTime platform support › Intraday Stats During Opening Hours
- This topic has 11 replies, 3 voices, and was last updated 1 year ago by robertogozzi.
-
-
11/18/2022 at 12:50 PM #204389
Hi there, was wondering if anybody could help with this simple requirement:
Let’s use Australia 200 Cash CFD for the below example.
Is there a simple way to click a button or have an indicator whereby on click the following happen:
- The chart immediately snaps to a view showing the opening hours (10am – 4pm) on the 5m chart (i.e. the screen will only show 72 5min candles).
- Or if this is not possible then alternatively have the platform draw vertical separators or colour code the period between 10am-4pm.
- Then of those 72 candles on screen, it will show the Open, Close, High and Low for the 10am-4pm session only (not showing premarket data). Perhaps right in the top left corner for convenience.
- Bonus: And even better if I could make one click to export the Open, Close, High and Low in CSV format.
I was wondering if the above can be achieved with some simple configuration and not requiring any coding?
Thanks in advance!
11/18/2022 at 4:19 PM #20439311/19/2022 at 4:10 PM #204471Hi JS thanks for responding.
I was hoping more something like this. Was wondering if this is possible out of the box or will I need to program some custom indicator?
Say I have a chart with a n number of candles on screen. I’d like to see the high, low, open and close only for the set of candles on screen like below.
Additionally when trading an instrument such as Australia 200 Cash CFD the price data is continuous as it is based on the futures price which trade 24 hours a day 5 days a week.
And this makes it hard to see the times that matter which are the opening hours (in this case 10am-4pm). So was wondering is there a way to have color-coded session breaks like this?
Thanks and appreciate your input.
11/19/2022 at 4:55 PM #204475Hi Voyager,
For the colored background you can use the indicator…
You can set the color yourself according to the RGB table…
Coloured BackGround1234567891011121314151617SessionStart = 100000SessionEnd = 160000If OpenTime >= SessionStart and OpenTime <= SessionEnd thenr = 255g = 255b = 0t = 0Elser = 255g = 255b = 255t = 255EndIfBackGroundColor(r,g,b,t)Return11/19/2022 at 5:13 PM #204476As for the Open/High/Low/Close…
Each bar/candle has its own Open/High/Low/Close
What you show on your screenshot is the Open of the session and the highest value, the lowest value and the Close of the session. You won’t know these values until the session ends…
You can determine these values with:If OpenTime = SessionStart then
xOpen = Open
ElsIf OpenTime = SessionEnd then
xClose = Close
xHigh = Highest[72](High)
xLow = Lowest[72](Low)
EndIf11/19/2022 at 9:41 PM #204486Hi @Voyager
Here is the full indicator with colored background and text…
Perhaps needless to say:
- Import the “itf -file” (under “Indicators”)
- Add the indicator below the “Price” (top left of your chart)
BackGroundColor + Text12345678910111213141516171819202122232425262728293031323334353637SessionStart = 100000SessionEnd = 160000If OpenTime >= SessionStart and OpenTime <= SessionEnd thenr = 255g = 255b = 0t = 255Elser = 255g = 255b = 255t = 255EndIfBackGroundColor(r,g,b,t)If OpenTime = SessionStart thenxOpen = OpenElsIf OpenTime = SessionEnd thenxClose = ClosexHigh = Highest[72](High)xLow = Lowest[72](Low)EndIfN=72For i=0 to N-1If Open[i] = xOpen thenDrawText("Open=#xOpen#",BarIndex-i+5, xOpen,SansSerif,Bold,15)Coloured(255,0,0)ElsIf High[i] = xHigh thenDrawText("High=#xHigh#",BarIndex-i, xHigh+5,SansSerif,Bold,15)Coloured(255,0,0)ElsIf Low[i] = xLow thenDrawText("Low=#xLow#",BarIndex-i, xLow-5,SansSerif,Bold,15)Coloured(255,0,0)ElsIf Close[i+1] = xClose thenDrawText("Close=#xClose#",BarIndex-i, xClose,SansSerif,Bold,15)Coloured(255,0,0)EndIfNextReturn1 user thanked author for this post.
11/20/2022 at 9:47 AM #204495Hi @Voyager thanks for the code snippets, much appreciated!
You’ve helped me resolve the colored background for the session and that’s visually very helpful and that bit is all good now.
Regarding the annotation of the chart with the Session Open, Close, High and Low it’s getting really close to what I had in mind.
I was wondering if it were possible to access specific bars based on specific time conditions and not just based on using the index offsets.
The reason for this is if I switch from a 5m chart to a 15m chart the offset is no longer 72 candles but instead only 24 15 minute bars between 10am-4pm. And if I switch to a 10m it will be 36 bars.
Perhaps this will illustrate better what I mean. I’ve added some pseudo-code in [brackets]:
123456789101112131415161718192021222324252627282930313233SessionStart = 100000SessionEnd = 160000If OpenTime >= SessionStart and OpenTime <= SessionEnd thenr = 229g = 255b = 204t = 80Elser = 255g = 255b = 255t = 0EndIfBackGroundColor(r,g,b,t)If OpenTime = SessionStart thenxOpen = OpenElsIf OpenTime = SessionEnd thenxClose = ClosexHigh = <strong>[Highest price during the period between 10am-4pm?]</strong>xLow = <strong>[Lowest price during the period between 10am-4pm?]</strong>EndIf// Annotate chartDrawText(xOpen)DrawText(xClose)DrawText(xHigh)DrawText(xLow)<strong>[Or use Dynamic Horizontal Line if possible?]</strong>ReturnAlso while playing around with the settings, I came across Dynamic Horizontal Line and was wondering if we could utilise that in the code instead of using DrawText?
But if that is not possible (I’m guessing it will draw 4 lines for every single day thus cluttering the entire chart?) the text annotation is very much good enough.
Thanks for your input.
11/20/2022 at 9:02 PM #204538Hi @Voyager
The problem with the text can be solved with “GetTimeFrame”
“GetTimeFrame” gives the time frame in seconds so you can calculate the periods with:
GTF = GetTimeFrame
Period = 3600 / GTF * 6
BackGroundColor + Text V2123456789101112131415161718192021222324252627282930313233343536373839SessionStart = 100000SessionEnd = 160000If OpenTime >= SessionStart and OpenTime <= SessionEnd thenr = 255g = 255b = 0t = 255Elser = 255g = 255b = 255t = 255EndIfBackGroundColor(r,g,b,t)GTF = GetTimeFramePeriod = 3600 / GTF * 6If OpenTime = SessionStart thenxOpen = OpenElsIf OpenTime = SessionEnd thenxClose = ClosexHigh = Highest[Period](High)xLow = Lowest[Period](Low)EndIfFor i=0 to Period-1If Open[i] = xOpen thenDrawText("Open=#xOpen#",BarIndex-i, xOpen,SansSerif,Bold,15)Coloured(255,0,0)ElsIf High[i] = xHigh thenDrawText("High=#xHigh#",BarIndex-i, xHigh+5,SansSerif,Bold,15)Coloured(255,0,0)ElsIf Low[i] = xLow thenDrawText("Low=#xLow#",BarIndex-i, xLow-5,SansSerif,Bold,15)Coloured(255,0,0)ElsIf Close[i+1] = xClose thenDrawText("Close=#xClose#",BarIndex-i, xClose,SansSerif,Bold,15)Coloured(255,0,0)EndIfNextReturn11/22/2022 at 1:50 AM #204599Hi @JS thanks for the new code using time to calculate the daily highs and lows.
I saw your attached screenshot and it looks great however I seem to be unable to reproduce it on my end? I copied your code as is.
I was confused because I keep getting lots of overlapping text during the Market Open hours (i.e. the periods with highlighted background) such that it becomes unreadable.
And also in your screenshot there is no text annotation for the Market Close hours which is what I was expecting on my end too. However I get a lot of “noise” during Market Close periods with lots of Highs and Lows being reported which I was surprised because they fall outside the time period that the IF statement should take care of?
Any idea what could be causing this overlapping and unclear text?
11/22/2022 at 8:02 AM #204609Hi @Voyager
Try this…
BackGroundColor + Text V3123456789101112131415161718192021222324252627282930313233343536373839//DefParam DrawOnLastBarOnly = TrueSessionStart = 100000SessionEnd = 160000If OpenTime >= SessionStart and OpenTime <= SessionEnd thenr = 255g = 255b = 0t = 255Elser = 255g = 255b = 255t = 255EndIfBackGroundColor(r,g,b,t)GTF = GetTimeFramePeriod = 3600 / GTF * 6If OpenTime = SessionStart thenxOpen = OpenDrawText("Open=#xOpen#",BarIndex, Open,SansSerif,Bold,15)Coloured(255,0,0)EndIfIf OpenTime = SessionEnd thenxClose = CloseDrawText("Close=#xClose#",BarIndex, xClose,SansSerif,Bold,15)Coloured(255,0,0)xHigh = Highest[Period](High)xLow = Lowest[Period](Low)For i=0 to Period-1If High[i] = xHigh thenDrawText("High=#xHigh#",BarIndex-i, xHigh+5,SansSerif,Bold,15)Coloured(255,0,0)ElsIf Low[i] = xLow thenDrawText("Low=#xLow#",BarIndex-i, xLow-5,SansSerif,Bold,15)Coloured(255,0,0)EndIfNextEndIfReturn11/26/2022 at 11:55 AM #204846Hi @JS thanks for the code.
I’ve just tested it and it works much better now with far fewer overlapping text. For some reason there is still some but far less such that I can live with that.
I’ll have a go at implementing your code for both the session background color and the High/Lows for other timezones and other markets myself.
Thanks for your help with this and I believe I can mark this support topic as resolved now.
I hope you have a nice weekend!
1 user thanked author for this post.
11/26/2022 at 11:30 PM #204879Do not embed pics and other files in your post, as this slows down the loading of pages; Select File is all you need to attach them.
Thank you 🙂
- The chart immediately snaps to a view showing the opening hours (10am – 4pm) on the 5m chart (i.e. the screen will only show 72 5min candles).
-
AuthorPosts
Find exclusive trading pro-tools on