Monthly High Low Close Indicator
Forums › ProRealTime English forum › ProBuilder support › Monthly High Low Close Indicator
- This topic has 49 replies, 13 voices, and was last updated 3 years ago by MacroT.
-
-
11/02/2016 at 4:32 PM #15871
Hi all,
hope someboday can fix that little problem. I want that indicator to show previous month high low and close in any lower timeframe. Highs and lows works fine but the monthly close shows the wrong price.
thanks in advance
12345678910111213141516171819202122once monthlyHigh=undefinedonce monthlyLow=undefinedonce monthlyClose=undefineddailyHigh= DHigh(1)dailyLow= DLow(1)// monthly high/lowIf Month <> Month[1] thenmonthlyHigh = Highest[BarIndex - lastMonthBarIndex](dailyHigh)monthlyLow = Lowest[BarIndex - lastMonthBarIndex](dailyLow)lastMonthBarIndex = BarIndexENDIF// monthly closeIf Month <> Month[1] thenmonthlyClose = DClose(1)[BarIndex - lastMonthBarIndex]lastMonthBarIndex = BarIndexENDIFreturn monthlyHigh as "Prev Month High", monthlyLow as "Prev Month Low", monthlyClose as "Prev Month Close"11/02/2016 at 5:27 PM #15875Hi, is it for cfd’s with IG? Could be that on the last day of the month, apart maybe from December because of early market close on the 31st, if the candle close in its market happens to be at midnight or more in your time zone, the month on your last candle is switching early (for example a return of 5 for may on the last day of April, but a return of 4 of the day before that) therefore triggering your “month<>month[1]” condition 1 day early (or 1 candle early in lower time frames)
A quick fix to this could be to use “openmonth” instead of “month”, because your last day of the month most likely still starts on the “proper” month regardless of the time difference between your area and the cfd market close time.
Also line 19 could be shorter, all together a suggestion for lines 18 to 21 could be:
1234If openMonth <> openMonth[1] thenmonthlyClose = DClose(1)lastMonthBarIndex = BarIndexENDIF1 user thanked author for this post.
11/02/2016 at 10:06 PM #1587911/03/2016 at 8:24 AM #15885I did not propose to give month open price level instead of close. That’s why I kept part of your line 19 when using Dclose of last day of previous month and wrote:
1monthlyClose = DClose(1)And in your line 18, when instead of “month” I suggested using “openMonth”, it might be worth reminding openMonth is not the month open price level, it is the month number in which the candle opens (the same way “Month” is not the close price level but is the month number in which the candle closes).
Using “openmonth” instead of “month” makes sure you avoid the glitch of month number switching one candle earlier than you want, because your “if month<>month[1]” is triggered on last day of month rather than first day of new month, and captures close of the day-before-last (which you don’t want) rather than the last day of the month (which you want).
06/12/2017 at 11:25 AM #3813306/12/2017 at 12:48 PM #38140Quarter high/low can be retrieved with this code snippet:
1234567891011121314151617If Month<>Month[1] thenmonthlyH = Highest[BarIndex - lastMonthBarIndex](High)[1]monthlyL = Lowest[BarIndex - lastMonthBarIndex](Low)[1]lastMonthBarIndex = BarIndexif trimH=0 thentrimH=monthlyHendiftrimH=max(trimH,monthlyH)if trimL=0 thentrimL=monthlyLendiftrimL=min(trimL,monthlyL)if openmonth=4 or openmonth=7 or openmonth=10 or openmonth=1 thentrimestrialH=trimHtrimestrialL=trimLendifEndif06/13/2017 at 10:54 AM #3820406/13/2017 at 11:09 AM #38207Sorry, wrong code, this one should work better:
123456789101112trimH=max(trimH,high)trimL=min(trimL,low)If openMonth<>openMonth[1] thenif openmonth=4 or openmonth=7 or openmonth=10 or openmonth=1 thentrimestrialH=trimHtrimestrialL=trimLtrimL=close*100trimH=0endifEndifreturn trimestrialH,trimestrialL06/13/2017 at 4:21 PM #3822706/16/2017 at 8:28 PM #38479Hello, I try to code a screener that display the forex pairs whose price closes (in daily) on the previous highest (display number 2), below the previous lowest (display number 1) or in the middle (display number 0) for monthly and quarterly.
Unfortunately nothing appears when launching this screener and I don’t understand why ?1234567891011121314151617181920212223242526272829303132333435363738394041424344timeframe(daily)// previous monthly high/lowif Month <> Month[1] thenMhi = Highest[BarIndex - lastMonthBarIndex](DHigh(1))Mlo = Lowest[BarIndex - lastMonthBarIndex](DLow(1))lastMonthBarIndex = BarIndexendif// previous quartly high/lowtrimH = max(trimH,high)trimL = min(trimL,low)if openmonth <> openmonth[1] thenif openmonth = 4 or openmonth = 7 or openmonth = 10 or openmonth = 1 thenQhi = trimHQlo = trimLtrimL = close*100trimH = 0endifendifif close > Qhi thenq = 20endifif close < Qlo thenq = 10endifif close < Qhi and close > Qlo thenq = 0endifif close > Mhi thenm = 2endifif close < Mlo thenm = 1endifif close < Mhi and close > Mlo thenm = 0endift = q + mSCREENER (t as "Q M")06/19/2017 at 9:22 AM #38576I can not do anything with OpenMonth, I fixed the screener to return information with “Month” instead, but the values of the quarters may not be the right ones, to be checked:
1234567891011121314151617181920212223242526272829303132333435363738// previous quartly high/lowtrimH = max(trimH,high)trimL = min(trimL,low)if month <> month[1] thenMhi=trimHMlo=trimLif month = 4 or month = 7 or month = 10 or month = 1 thenQhi = trimHQlo = trimLtrimL = close*100trimH = 0endifendifif close > Qhi thenq = 20endifif close < Qlo thenq = 10endifif close < Qhi and close > Qlo thenq = 0endif//m=0if close > Mhi thenm = 2endifif close < Mlo thenm = 1endifif close < Mhi and close > Mlo thenm = 0endift = q + mSCREENER (t as "Q M")06/19/2017 at 12:46 PM #3859309/19/2017 at 2:01 PM #46593Hello, what is wrong, why is this not working?
Daily close above below monthly high low123456789101112131415161718192021222324AboveMonthlyHigh = 0BelowMonthlyLow=0once monthlyHigh=undefinedonce monthlyLow=undefineddailyHigh= DHigh(1)dailyLow= DLow(1)// monthly high/lowIf Month <> Month[1] thenmonthlyHigh = Highest[BarIndex - lastMonthBarIndex](dailyHigh)monthlyLow = Lowest[BarIndex - lastMonthBarIndex](dailyLow)lastMonthBarIndex = BarIndexENDIFIf Dclose(0) > monthlyHigh[1] thenAboveMonthlyHigh = 1endifIf Dclose(0) < monthlyLow[1] thenBelowMonthlyLow = 1endifSCREENER [AboveMonthlyHigh or BelowMonthlyLow]09/22/2017 at 8:58 AM #46888Strange, this code works as an indicator but not as a screener??
12345678910If Month <> Month[1] thenmonthlyHigh = Highest[BarIndex - lastMonthBarIndex](High)monthlyLow = Lowest[BarIndex - lastMonthBarIndex](Low)lastMonthBarIndex = BarIndexENDIFC1 = Dclose(0) > monthlyHighC2 = Dclose(0) < monthlyLowSCREENER[C1 or C2]1 user thanked author for this post.
09/22/2017 at 9:14 AM #46890Because it needs at least some history to be loaded (barindex>20):
12345678910If Month <> Month[1] and barindex>20 thenmonthlyHigh = Highest[BarIndex - lastMonthBarIndex](High)monthlyLow = Lowest[BarIndex - lastMonthBarIndex](Low)lastMonthBarIndex = BarIndexENDIFC1 = Dclose(0) > monthlyHighC2 = Dclose(0) < monthlyLowSCREENER[C1 or C2]I still have some of your posts in pending review, because you didn’t send me the code in open source format 🙂 You can send them to me at my email: nicolas[at]prorealcode.com ; many thanks for sharing!
-
AuthorPosts
Find exclusive trading pro-tools on