It is simpler to say that it’s the first week of the year is when Jan1st is on Thursday or earlier, if it’s later then it belongs to the prior year.
Perfect @robertogozzi
Thanks to the above link I’m going to get another headache 🤣, tks again 😊
Let’s continue with the daily profit losses, my trading day starts at IntraDayBarIndex 98, So I have to measure the daily profit between 98 on Monday until 97 on Tuesday, and I initialize all my earnings on Sunday :
However I have a small problem, if a position is opened on Monday and only closed on Tuesday, then Monday’s profits are not calculated as the position is not closed on Monday, but I will have unrealised gains or losses to calculate for Monday
IF (DayOfWeek=1 AND IntraDayBarIndex>=98) OR (DayOfWeek=2 AND IntraDayBarIndex < 98) THEN
MondayProfit = DayProfitEuro
ELSIF (DayOfWeek=2 AND IntraDayBarIndex>=98) OR (DayOfWeek=3 AND IntraDayBarIndex < 98)THEN
TuesdayProfit = DayProfitEuro
ELSIF (DayOfWeek=3 AND IntraDayBarIndex>=98) OR (DayOfWeek=4 AND IntraDayBarIndex < 98)THEN
WednesdayProfit = DayProfitEuro
ELSIF (DayOfWeek=4 AND IntraDayBarIndex>=98) OR (DayOfWeek=5 AND IntraDayBarIndex < 98)THEN
ThursdayProfit = DayProfitEuro
ELSIF DayOfWeek = 5 AND IntraDayBarIndex > 98 THEN
FridayProfit = DayProfitEuro
ELSIF DayOfWeek = 0 THEN
MondayProfit = 0
TuesdayProfit = 0
WednesdayProfit = 0
ThursdayProfit = 0
FridayProfit = 0
ENDIF