Monday = INTRADAYBARINDEX : 11 ?
Forums › ProRealTime English forum › ProOrder support › Monday = INTRADAYBARINDEX : 11 ?
- This topic has 21 replies, 5 voices, and was last updated 1 year ago by ZeroCafeine.
-
-
05/09/2023 at 4:24 PM #214429
Perfect 😊, I’ve been racking my brain for another 40 minutes to understand your explanation and that of @JC_Bywan
@All
I thank you very much for your answers and your help,
I finally realized my mistake, which was simply that I was not resetting my variable, I was torturing my head to make it true but it was never reset to false
I enclose a small diagram that could help other readers before throwing it away
05/11/2023 at 9:18 AM #214499hi everyone,
that is now my day of week period for my math :
12345678910111213141516171819202122232425262728IF (DayOfWeek = 1 AND Time > 080500) THENMyMondayPeriod = 1MyFridayPeriod = 0ENDIFIF (DayOfWeek >= 2 AND Time > 080500) THENMyMondayPeriod = 0ENDIFIF (DayOfWeek = 2 AND Time > 080500) THENMyTuesdayPeriod = 1ENDIFIF (DayOfWeek >= 3 AND Time > 080500) THENMyTuesdayPeriod = 0ENDIFIF (DayOfWeek = 3 AND Time > 080500) THENMyWednesdayPeriod = 1ENDIFIF (DayOfWeek >= 4 AND Time > 080500) THENMyWednesdayPeriod = 0ENDIFIF (DayOfWeek = 4 AND Time > 080500) THENMyThursdayPeriod = 1ENDIFIF (DayOfWeek >= 5 AND Time > 080500) THENMyThursdayPeriod = 0ENDIFIF (DayOfWeek = 5 AND Time > 080500) THENMyFridayPeriod = 1ENDIFI find myself with a new problem, I will try to think about it and especially to formulate the question well 😊
05/11/2023 at 9:45 AM #214508123456789101112131415MyMondayPeriod = 0MyTuesdayPeriod = 0MyWednesdayPeriod = 0MyThursdayPeriod = 0MyFridayPeriod = 0MySaturdayPeriod = 0 // Theoretically.MySundayPeriod = 0 // Theoretically.IF (DayOfWeek = 1 AND Time > 080500) THENMyMondayPeriod = 1ENDIFIF (DayOfWeek = 2 AND Time > 080500) THENMyTuesdayPeriod = 1ENDIF[...] // :-)1 user thanked author for this post.
05/11/2023 at 4:17 PM #214559that is my new code :
1234567891011121314151617181920IF (DayOfWeek = 1 AND Time > 080500) THENMyMondayPeriod = 1MyFridayPeriod = 0ENDIFIF (DayOfWeek = 2 AND Time > 080500) THENMyMondayPeriod = 0MyTuesdayPeriod = 1ENDIFIF (DayOfWeek = 3 AND Time > 080500) THENMyTuesdayPeriod = 0MyWednesdayPeriod = 1ENDIFIF (DayOfWeek = 4 AND Time > 080500) THENMyWednesdayPeriod = 0MyThursdayPeriod = 1ENDIFIF (DayOfWeek = 5 AND Time > 080500) THENMyThursdayPeriod = 0MyFridayPeriod = 1ENDIF
@PeterSt
Thank you very much for your answer, I tested your code but it does not work as I want, I explain :
my Monday period starts on Monday at 08:05 and ends on Tuesday at 08:00with your method that we will call solution B, the condition is false between the bar index 0 of Tuesday until Tuesday 8:00 am
Solution A (Mine) :
123456IF (DayOfWeek = 1 AND Time > 080500) THENMyMondayPeriod = 1ENDIFIF (DayOfWeek = 2 AND Time > 080500) THENMyMondayPeriod = 0ENDIFSolution B (PeterSt) :
1234MyMondayPeriod = 0IF (DayOfWeek = 1 AND Time > 080500) THENMyMondayPeriod = 1ENDIF05/11/2023 at 5:35 PM #214564with your method that we will call solution B, the condition is false between the bar index 0 of Tuesday until Tuesday 8:00 am
I understand. But I had to guess that your Instrument would open at 08:00 – e.g. almost all Eurex.
So what you say is that e.g. on Monday at 07:55 you still want to use Friday as MyxxxxPeriod ?
Anyway, I thought to rewrite your code a little shorter and with less redundancy. If that functionally can’t work (I understand that now) then apologies for the noise.
05/12/2023 at 1:11 PM #214607I understand. But I had to guess that your Instrument would open at 08:00 – e.g. almost all Eurex.
Yes, you’re right, the goal is to learn and master the programming, I also say to myself that Forex is a 24 hour market and that it is traded mostly by robots like all markets, so start at 8am or just after or just before, I think we understand each other
So what you say is that e.g. on Monday at 07:55 you still want to use Friday as MyxxxxPeriod ?
As far as the period from Friday to Monday 8am is concerned it doesn’t make sense, but as I take trades due every day from 8am onwards I would like to know how much I lost the day before, hence the calculation of this period in case on Friday I don’t cut all or part of my position and there are leftovers
Anyway, I thought to rewrite your code a little shorter and with less redundancy. If that functionally can’t work (I understand that now) then apologies for the noise.
you have thought and you have done very well to answer me, any answer or remark or criticism is more than welcome 😃
05/14/2023 at 11:18 AM #214677You did well to ask the question, I noticed that there was an overlap and that the values were not reset at the right time between Friday and Monday 😊
-
AuthorPosts