Determine a specific day
Forums › ProRealTime English forum › ProBuilder support › Determine a specific day
- This topic has 6 replies, 3 voices, and was last updated 7 years ago by Business Trader Pro.
-
-
08/04/2017 at 8:59 AM #42471
Hi guys,
is there a way to retrieve a specific day of the year? For example: My indicator should show me the 01.04.2017 and the 02.07.2017 with backgroundcolor.
I need this because my trading system should rebalance my positions quarterly.
Thanks in advance
Business Trader
08/04/2017 at 2:43 PM #42481You may try this piece of code (I tested it, but I am not sure that’s what you want):
123456789IF Month = 1 OR Month = 4 OR Month = 7 OR Month = 10 THEN //only 1st month of each quarterFOR I = 0 TO 6 //scan a whole week to check it's FOREX timeIF Day = i AND DayOfWeek = 2 THEN //only color the first Mondaybackgroundcolor(173,255,47,128) //Green Yellow (255,128,64,32 or 0 in the 4th group of numbers is the FADE gradient, 255=max 0=invisible)break //if found then skip any further checkENDIFNEXTENDIFRETURN08/10/2017 at 3:24 PM #42938Thx Roberto,
il will give it a try and let you know about the results.
Greets from Italy to Italy 😉
08/10/2017 at 4:44 PM #42946I tried your code with following results:
It shows me (plus/minus) the first monday of each month. The goal should be to fetch every first trading day (not saturday or sunday) of the quarter.
Any solutions?
Many regards
Tradewolf
08/10/2017 at 6:42 PM #42952I tried this one:
1234567891011ONCE DayFound = 1IF Month <> Month[1] THENDayFound = 0ENDIFIF Month = 1 OR Month = 4 OR Month = 7 OR Month = 10 THENIF ((DayOfWeek = 1) OR (DayOfWeek = 2) OR (DayOfWeek = 3) OR (DayOfWeek = 4) OR (DayOfWeek = 0)) AND (DayFound = 0) THENbackgroundcolor(173,255,47,255)DayFound = 1ENDIFENDIFRETURNBut it does not work as expected. I still cannot understand, for DAILY bars, what is returned bu DayOfWeek when the indicator is executed, the DAY of the closed BAR or the DAY of the bar which is opening?!
And If I want to change the background it changes the nackground color of the opening bar, since the bar that is close has already been displayed on video, is it true?
Only Nicolas can help us out! Thanks a lot!!!
08/10/2017 at 7:28 PM #42958The following code should work, not just for standard quarters, but also even with a January 1st on a friday the code should/would pick monday Jan.4th instead of friday Jan.1st:
1234567891011If (OpenMonth=1 or Openmonth=4 or Openmonth=7 or Openmonth=10) and OpenDay<=4 and OpenDayOfWeek>=1 and OpenDayOfWeek<=5 and opendate-firstdayofquarter>3 thenbackgroundcolor(0,0,255)firstdayofquarter=OpenDateendif// choose only one of the following 2 return lines:// - the empty return line if wanting only backgroundcolor,// - or the second return line if wanting to read dates data in yyyymmdd formatreturn//return firstdayofquarter as "first day of quarter"4 users thanked author for this post.
08/11/2017 at 12:56 PM #43026Thanks Noobywan, this did the trick. “OpenDay” was new to me. Never used it.
Regards
-
AuthorPosts
Find exclusive trading pro-tools on