Noise area indicator
Forums › ProRealTime English forum › ProBuilder support › Noise area indicator
- This topic has 12 replies, 3 voices, and was last updated 1 month ago by robertogozzi.
-
-
10/03/2024 at 3:44 PM #238467
Hi,
Trying to create a ”Noise area indicator” like the one attached in the paper below. I don´t get the calculation for the range done properly. Read it, and look at the attached picture.
https://papers.ssrn.com/sol3/papers.cfm?abstract_id=4824172
The most important metrics is as follows.
We have to mathematically define a region where prices are expected to oscillate under conditions of balanced buying and selling pressures. We refer to this region as the Noise Area, an equilibrium zone where markets do not exhibit any exploitable intraday trend.
Practically, the market demonstrates a lack of abnormal imbalances when the intraday
movement from the RTH Open is less than the average movement observed on the same intraday
time interval over the previous days. We define the Noise Area as the space between
2 boundaries. These boundaries are time-of-day dependent and are computed using the
average movements recorded over the previous 14 days.
Thank you!
Best regards.
10/03/2024 at 8:10 PM #238485I asked chatgtp and got this
Chatgtp12345678910111213141516171819202122232425262728293031// Parametersperiod = 14 // Look-back period (14 days)timeStart = 093000 // Start of RTH (Regular Trading Hours)timeNow = (hour * 10000) + (minute * 100) + second// Calculate today's opening priceif timeNow == timeStart thendayOpen = openendif// Calculate absolute movement from the Open at each time interval for the past 14 daysmoveSum = 0for i = 1 to period doif timeNow > timeStart thenprevMove = abs(close[i] / open[i] - 1) // Absolute movement from openmoveSum = moveSum + prevMoveendifnext// Average movement over the past 14 daysavgMove = moveSum / period// Calculate Upper and Lower BoundariesupperBound = dayOpen * (1 + avgMove)lowerBound = dayOpen * (1 - avgMove)// Plot the boundaries on the chartdrawhline(upperBound, "Upper Bound", color.rgb(0,0,255)) // Blue line for Upper Bounddrawhline(lowerBound, "Lower Bound", color.rgb(255,0,0)) // Red line for Lower Boundreturn10/06/2024 at 6:04 AM #238534ChatGPT has not a thourogh knowledge of the ProRealTime (also called ProBuilder) language, so it uses some generic instructions assuming most languages have similar instructions (which generally is).
After a few modification this is the working code:
12345678910111213141516171819202122232425262728293031// Parametersperiod = 14 // Look-back period (14 days)timeStart = 093000 // Start of RTH (Regular Trading Hours)timeNow = (hour * 10000) + (minute * 100) + second// Calculate today's opening priceif timeNow = timeStart thendayOpen = openendif// Calculate absolute movement from the Open at each time interval for the past 14 daysmoveSum = 0for i = 1 to period doif timeNow > timeStart thenprevMove = abs(close[i] / open[i] - 1) // Absolute movement from openmoveSum = moveSum + prevMoveendifnext// Average movement over the past 14 daysavgMove = moveSum / period// Calculate Upper and Lower BoundariesupperBound = dayOpen * (1 + avgMove)lowerBound = dayOpen * (1 - avgMove)// Plot the boundaries on the chartdrawhline(upperBound) coloured(0,0,255) // Blue line for Upper Bounddrawhline(lowerBound) coloured(255,0,0) // Red line for Lower Boundreturn10/06/2024 at 9:07 PM #238552I have tried Chat GPT to. Get some strange results at the beginnning but its get´s better when you use Pro language promts.
@robertogozzi Unfortunately, can´t see your corrected chat GPT code worked either. I only get a red line around zero on the index both on price or in a new panel.
Here is my one, but first. I´m not shore the calculation is right. And then i do not get it right when overlay it on a pricechart…
1234567891011121314151617181920212223242526272829303132333435// Noise Area Indicator - Regular Trading Hours Only// Define parametersLength = 14// Step 1: Track the RTH open price (fixed at 9:30)IF (hour = 9 AND minute = 30) THENopenRTH = Open[0] // Set the open price at 9:30ENDIF// Step 2: Ensure we are in RTH (Regular Trading Hours)IF (hour = 9 AND minute >= 30) OR (hour > 9 AND hour < 16) THEN// Step 3: Calculate the move in points from the Open for the current barmoveToday = ABS(Close - openRTH) // Absolute move in points from 9:30 open// Step 4: Calculate the average absolute move over the last 14 days in pointsavgMove = 0FOR i = 1 TO Length DOmovePast = ABS(Close[i] - Open[i]) // Calculate the absolute move in points for each of the last 14 daysavgMove = avgMove + movePast // Sum the movesNEXTavgMove = avgMove / Length // Average movement in points// Step 5: Compute the Upper and Lower Boundaries based on points from the open priceUpperBound = openRTH + avgMove // Upper boundary based on open priceLowerBound = openRTH - avgMove // Lower boundary based on open price// Step 6: Plot the Noise Area on the chart, anchored to the open priceDRAWSEGMENT(barindex - 1, UpperBound, barindex, UpperBound) COLOURED(255, 0, 0) // Red for Upper BoundDRAWSEGMENT(barindex - 1, LowerBound, barindex, LowerBound) COLOURED(0, 255, 0) // Green for Lower BoundENDIF// Step 7: Return values for ProBuilder to plot on the main price chartRETURN UpperBound AS "Upper Noise Boundary", LowerBound AS "Lower Noise Boundary"10/07/2024 at 3:47 PM #238610The code works, as you can see from the attached pic, there are no more errors.
Probably it doesn’t do what he expected, but that’s another question, as I don’t understand what he wants.
10/08/2024 at 2:21 PM #238719Yes, you are right @<span class=”bbp-author-name”>robertogozzi </span>it´s working! I was in the wrong timeframe at the beginning. Therefore i saw nothing. Then i changed your code to plot drawsegments instead of drawhline. Now we have done some progress here.
123456789101112131415161718192021222324252627282930// Parametersperiod = 14 // Look-back period (14 days)timeStart = 153000 // Start of RTH US (Regular Trading Hours) Adjusted for swedish time.timeNow = (hour * 10000) + (minute * 100) + second// Calculate today's opening priceif timeNow = timeStart thendayOpen = openendif// Calculate absolute movement from the Open at each time interval for the past 14 daysmoveSum = 0for i = 1 to period doif timeNow > timeStart thenprevMove = abs(close[i] / open[i] - 1) // Absolute movement from openmoveSum = moveSum + prevMoveendifnext// Average movement over the past 14 daysavgMove = moveSum / period// Calculate Upper and Lower BoundariesupperBound = dayOpen * (1 + avgMove)lowerBound = dayOpen * (1 - avgMove)// Plot the boundaries on the chartDRAWSEGMENT(barindex - 1, UpperBound, barindex, UpperBound) COLOURED(255, 0, 0) // Red for Upper BoundDRAWSEGMENT(barindex - 1, LowerBound, barindex, LowerBound) COLOURED(0, 255, 0) // Green for Lower BoundReturnBut, as you see in attached pictures something in the calculation is not correct. In the pics both show the same day, 31 of jan. 2022. from RTH Open 9:30 to close 16:00.
I will try to explain more in detail how i think it should be.
Definition: The Noise Area represents a price zone where the market is considered in balance—no significant demand or supply imbalance is occurring. Outside this area, deviations in price are considered exploitable trends, while within the zone, movements are attributed to market noise, and no trades are made.
Step 1: For each day and time, the absolute move from the RTH OPEN that day is calculated for the last 14 days.
Step 2: The average move over the last 14 days for each time of day is then calculated.
Step 3: The Upper and Lower boundaries of the Noise Area are calculated using the Open price of the current day, adjusted by the average move until that time. Typically, the average intraday movement from
the Open tends to increase over time, peaking at 16:00.Step4: (Maybe hard to achieve?)To make the evidence of potential imbalances more robust, include the closing from yesterdays RTH close price in
our calculation. This adjustment accounts for overnight gaps, which in themselves often
signal imbalances. For instance, following a gap-down event, the Upper Boundary of the
Noise Area is adjusted upward by a quantity equal to the gap size, and conversely for a
gap-up event, the Lower Boundary is adjusted downward.
With these considerations, the revised mathematical equations for the Upper and Lower Boundaries, including adjustments for overnight gaps, are as follows:UpperBoundt,HH:MM = max(Opent,9:30, Closet−1,16:00) × (1 + σt,9:30−HH:MM )
LowerBoundt,HH:MM = min(Opent,9:30, Closet−1,16:00) × (1 − σt,9:30−HH:MM )Hope this helps and make it more clear.
Thanks in advance!
10/08/2024 at 4:29 PM #23873410/08/2024 at 5:29 PM #23874010/09/2024 at 10:15 AM #238757The first two steps are clear.
Can you better explain “Step 3: The Upper and Lower boundaries of the Noise Area are calculated using the Open price of the current day, adjusted by the average move until that time. Typically, the average intraday movement from
the Open tends to increase over time, peaking at 16:00“?10/09/2024 at 12:19 PM #238770Step 3 is more a clarification of step 2. Line below is from the source of the original strategy PDF:
“Typically, the average intraday movement from the Open tends to increase over time, peaking at 16:00“
Meaning for example: Take SP500. Say the average range from Open 9:30 to 9:35 is 5 points. It is highly probable thats the average range from Open 9:30 to Close at 16:00 is alot bigger because price has had much longer time to move away and the range is then bigger.
This is possible to see in the two compared pictures i show in one of the earlier posts showing your coded noise area that expand around 5-10 points beside the picture of the noise area from the strategy PDF that have a range around 110 points at 16:00. Sure, its hard to say exactly because
the scale on that picture is not the same but you can see it roughly. Hope it helps.
10/10/2024 at 10:59 AM #238808No, it’s not much clear.
Let’s begin anew:
- what data do you want to be plotted in the highligheted rectangle (attached pic)
- hopw is those data related to the previous session?
- what is incorrect in the data you plotted?
10/10/2024 at 12:45 PM #238818Okey,
We try again.
I want to be able to see the 14 days average move from today’s open 9:30 to any time (depending on bar size) within regular trading hours drawn by segments on the chart. See my attached picture. Your indicator is in the backround, and i have adjusted that to show 3 day average in the code beacuse its easier when we see everything in the same picture. Thats only for this example.
I have tried the best i can to explain in the picture. Hopefully its easier to explain there.
10/11/2024 at 4:50 PM #238879I tried to code this one, but still I don’t know what has the average of the previous 14 periods to do with todays’a average?
You now introduced another 3-period lookback. Is that the same periods as the 14-periods or an additional lookback period?
Can you explain what data has to be dealt wit each session that needs to be used in the future sessions?
What happens at the start of each session?
What is to be calculated every bar of the new session?
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061// ParametersONCE Count = 0period = 14 // Look-back period (14 days)IF BarIndex = 0 THEN// initialilize array elelemtsFOR i = 1 TO period$dayMove[i] = 0NEXTENDIFtimeStart = 153000// Start of RTH US (Regular Trading Hours) Adjusted for swedish timetimeEnd = 230000// End of RTH US (Regular Trading Hours) Adjusted for swedish timetimeNow = time//(hour * 10000) + (minute * 100) + second// Calculate today's opening priceif timeNow = timeStart thendayOpen = openDayTally = 0TodaySmove = 0endifdayClose = close// Calculate today's opening priceif timeNow = timeEnd then// Calculate absolute movement from the Open at each time interval for the past 14 daysthisMove = abs(dayClose - dayOpen)moveSum = 0Count = Count + 1IF Count > period THENFOR i = period downto 2$dayMove[i] = $dayMove[i - 1]moveSum = moveSum + $dayMove[i]NEXT$dayMove[1] = thisMovemoveSum = moveSum + $dayMove[1]avgMove = moveSum / periodENDIFendif// Calculate absolute movement from the Open at each time interval for the past 14 days//moveSum = 0//for i = 1 to period do//if timeNow > timeStart then//prevMove = abs(close[i] / open[i] - 1) // Absolute movement from open//moveSum = moveSum + prevMove//endif//next// Average movement over the past 14 days//avgMove = moveSum / periodIF Count > period THENif (timeNow >= timeStart) AND (timeNow <= timeEnd) thenDayTally = DayTally + 1TodaySmove = (TodaySmove + abs(dayClose - dayOpen)) / DayTally// Calculate Upper and Lower BoundariesupperBound = DayOpen + avgMove + TodaySmove//close * (1 + avgMove)lowerBound = DayOpen - avgMove - TodaySmove//close * (1 - avgMove)// Plot the boundaries on the chartDRAWSEGMENT(barindex[1], UpperBound[1], barindex, UpperBound) COLOURED(255, 0, 0) // Red for Upper BoundDRAWSEGMENT(barindex[1], LowerBound[1], barindex, LowerBound) COLOURED(0, 255, 0) // Green for Lower BoundENDIFENDIFReturn -
AuthorPosts
Find exclusive trading pro-tools on