Monthly range and january/july range
Forums › ProRealTime English forum › ProBuilder support › Monthly range and january/july range
- This topic has 6 replies, 2 voices, and was last updated 5 years ago by FabiusMor.
-
-
01/13/2020 at 10:58 AM #116610
Good morning,
i’d like to code an indicator which shows two different ranges:
- the first draws two parallel dotted lines corresponding to the high and the low of the first candle of each month, so the lines are one month long.
- the second draws two parallel dotted lines corresponding to the high and the low of the first ten days of january and july, so the lines are one year long.
Please, see the attached picture for a better understanding.
Is this possible to code??
Thank you and have a nice day.
01/13/2020 at 12:48 PM #116624There you go.
This is for v10.3 (no dotted lines):
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950DEFPARAM DrawOnLastBarOnly = trueONCE MonthLO = lowONCE MonthHI = highONCE JanLO = lowONCE JanHI = highONCE JulLO = lowONCE JulHI = highONCE MonthStart = 0ONCE JanStart = 0ONCE JulStart = 0//IF OpenMonth <> OpenMonth[1] THENMonthLO = lowMonthHI = highMonthStart = barindexENDIF//IF OpenMonth = 1 THENIF OpenDay >= 1 AND OpenDay <= 10 THENIF OpenMonth <> OpenMonth[1] THENJanStart = barindexJanLO = lowJanHI = highENDIFJanLO = min(low,JanLO)JanHI = max(high,JanHI)ENDIFENDIF//IF OpenMonth = 7 THENIF OpenDay >= 1 AND OpenDay <= 10 THENIF OpenMonth <> OpenMonth[1] THENJulStart = barindexJulLO = lowJulHI = highENDIFJulLO = min(low,JulLO)JulHI = max(high,JulHI)ENDIFENDIF//DRAWSEGMENT(MonthStart,MonthHI,barindex,MonthHI) COLOURED(0,255,0,255) //GREENDRAWSEGMENT(MonthStart,MonthLO,barindex,MonthLO) COLOURED(255,0,0,255) //RED//DRAWSEGMENT(JanStart,JanHI,barindex,JanHI) COLOURED(0,0,255,255) //BLUEDRAWSEGMENT(JanStart,JanLO,barindex,JanLO) COLOURED(148,0,211,255) //DARKVIOLET//DRAWSEGMENT(JulStart,JulHI,barindex,JulHI) COLOURED(255,215,0,255) //GOLDDRAWSEGMENT(JulStart,JulLO,barindex,JulLO) COLOURED(169,169,169,255) //DARKGREYRETURNIf you have version 11 and want to plot dotted lines, then replace the DRAWSEGMENT lines with:
12345678DRAWSEGMENT(MonthStart,MonthHI,barindex,MonthHI) COLOURED(0,255,0,255) STYLE(dottedline,2) //GREENDRAWSEGMENT(MonthStart,MonthLO,barindex,MonthLO) COLOURED(255,0,0,255) STYLE(dottedline,2) //RED//DRAWSEGMENT(JanStart,JanHI,barindex,JanHI) COLOURED(0,0,255,255) STYLE(dottedline,2) //BLUEDRAWSEGMENT(JanStart,JanLO,barindex,JanLO) COLOURED(148,0,211,255) STYLE(dottedline,2) //DARKVIOLET//DRAWSEGMENT(JulStart,JulHI,barindex,JulHI) COLOURED(255,215,0,255) STYLE(dottedline,2) //GOLDDRAWSEGMENT(JulStart,JulLO,barindex,JulLO) COLOURED(169,169,169,255) STYLE(dottedline,2) //DARKGREY1 user thanked author for this post.
01/13/2020 at 1:33 PM #116637Awesome! Thank you very much Roberto!
Just one little thing: it looks like that for the january/july range it takes into consideration just the first six candles ( instead of ten) to estabilish the high and the low.
I gave a look at the code but can’t find anything that could lead to that.
01/13/2020 at 1:44 PM #116638You wrote the first 10 days, not the first 10 trading days.
I’ll add a counter to achieve that, asap.
01/13/2020 at 1:45 PM #11664001/13/2020 at 2:37 PM #116653This is the version for the first 10 trading days:
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162DEFPARAM DrawOnLastBarOnly = trueONCE MonthLO = lowONCE MonthHI = highONCE JanLO = lowONCE JanHI = highONCE JulLO = lowONCE JulHI = highONCE MonthStart = 0ONCE JanStart = 0ONCE JulStart = 0//IF OpenMonth <> OpenMonth[1] THENMonthLO = lowMonthHI = highMonthStart = barindexENDIF//IF OpenMonth = 1 THENIF OpenDay >= 1 AND OpenDay <= 30 THENIF OpenMonth <> OpenMonth[1] THENJanStart = barindexJanLO = lowJanHI = highCount = 1ENDIFIF Count <= 10 THENJanLO = min(low,JanLO)JanHI = max(high,JanHI)ENDIFIF OpenDay <> OpenDay[1] THENCount = Count + 1ENDIFENDIFENDIF//IF OpenMonth = 7 THENIF OpenDay >= 1 AND OpenDay <= 30 THENIF OpenMonth <> OpenMonth[1] THENJulStart = barindexJulLO = lowJulHI = highCount = 1ENDIFIF Count <= 10 THENJulLO = min(low,JulLO)JulHI = max(high,JulHI)ENDIFIF OpenDay <> OpenDay[1] THENCount = Count + 1ENDIFENDIFENDIF//DRAWSEGMENT(MonthStart,MonthHI,barindex,MonthHI) COLOURED(0,255,0,255) //GREENDRAWSEGMENT(MonthStart,MonthLO,barindex,MonthLO) COLOURED(255,0,0,255) //RED//DRAWSEGMENT(JanStart,JanHI,barindex,JanHI) COLOURED(0,0,255,255) //BLUEDRAWSEGMENT(JanStart,JanLO,barindex,JanLO) COLOURED(148,0,211,255) //DARKVIOLET//DRAWSEGMENT(JulStart,JulHI,barindex,JulHI) COLOURED(255,215,0,255) //GOLDDRAWSEGMENT(JulStart,JulLO,barindex,JulLO) COLOURED(169,169,169,255) //DARKGREYRETURNfor v11 you need to replace the same lines as before (they are not affected by modifications).
1 user thanked author for this post.
01/13/2020 at 2:52 PM #116655 -
AuthorPosts
Find exclusive trading pro-tools on