At some point, I am pretty sure I will understand.

I am using the explorer a lot, that is how I know things are not working and that I am doing something wrong. But knowing you are doing something wrong.... and understanding what the error is I am making, and knowing why it is wrong, and then finding the right solution.... that is something completely different

As said, it will come, and thank you for the help getting there. Believe me, I, and probably many other users, are not unwilling, it's just very very very tough. Some get it in 5 minutes, others, well... this piece of code you are seeing there.... think I looked and tried to understand it, ran it in the explorer, went through every step... for atleast 3 hours.... The rest of the script, several hours more.

```
DaysToThirdWednesday = IIf (3-wd<0, (10-wd) % 7, (3 - wd) % 7);
// thursday to saturday will be <0 in the 3-wd calculation.
// sunday monday tuesday will be >0
// wednesday will be equal
// result for thursday = (10 - 4) = 6 % 7 = 6
//result for monday = (3 - 1) = 2 % 7 = 2
//lets run this for monday 18th oktober 2021 to see what the calculation does.
// in oktober 2021 the 20th was the 3rd wednesday
ThirdWednesday = ((d + DaysToThirdWednesday) % 7)+14;
// monday before expiration is day 18, results for DTTW is 2 which would result in:
// ((18 + 2) %7)
// 20 % 7 = 6 + 14 = 20
// 20th is the 3rd wednesday.....
// Running it for tuesday the 5th:
// DTTW = 3-2 = 1 = >0 = (3 - 2) = 1%7 = 1
// TWD = 5 + 1 =6%7 = 6 + 14 = 20
//
// THE CALCULATION WILL RETURN THE DATE FOR 3RD WEDNESDAY !!!!!!
ThirdWednesday = IIf(ThirdWednesday==14, 19, ThirdWednesday); //corrects problem if the first of the month is a Saturday
// Lets forget about this correction until we understand the rest of the code.
DaysToThirdWednesday = (ThirdWednesday - d);
// For monday the 18th this will be: 20 - 18 = 2
// This will calculate how many days there are untill 3rd wednesday.
// for tuesday the calculation will return 1. This is correct for the way we want to use the weighted contango
// for wednesday the calculation will return 0 and the new month will need to be used.
// thursday 21st oktober the calculation will be:
// DaysToThirdWednesday = IIf (3-wd<0, (10-wd) % 7, (3 - wd) % 7);
// wd = 4 3-4 = -1 =<0 (10-4) = 6 % 7 = 6
// ThirdWednesday = ((d + DaysToThirdWednesday) % 7)+14;
// (21 + 6) = 29 % 7 = 1 + 14 = 15
// DaysToThirdWednesday = ThirdWednesday - d;
// 15 - 21 = -7
// thursday 16-9 the calculation will be:
// DTTW 10-4 = 6 % 7 = 6
// TW 16 + 6 = 22 % 7 = 1 + 14 = 15
// DTTW 15 - 16 = -1
x = DaysToThirdWednesday;// array
is_greater_zero = x > 0;
MonthNumber = Month();
MonthNumber = MonthNumber -1;
UntilNext = IIf(is_greater_zero, DaysToThirdWednesday, DaysToThirdWednesday + 31 - (31 - DaysInMonth(Month(),Year())));
SincePrev = IIf(is_greater_zero, abs(DaysToThirdWednesday), abs(DaysToThirdWednesday - 31 + (31 - DaysInMonth(MonthNumber,Year()))));
/*
If(DaysToThirdWednesday[0] > 0)
{
UntilNext = 3;
SincePrev = 4;
//untilNext = DaysToThirdWednesday; //correct
MonthNumber = Month();
MonthNumber = MonthNumber -1;
//sincePrev = abs(DaysToThirdWednesday - 31 + (31 - DaysInMonth(MonthNumber,Year())));
}
else
{
//sincePrev = abs(DaysToThirdWednesday + 31 - (31 - DaysInMonth(Month(),Year())));
SincePrev = 2;
untilnext = 1;
}
*/
/*
if(DaysToThirdWednesday[0] > 0)
{
untilNext = DaysToThirdWednesday; // correct. For oct 18th this will be 2
MonthNumber = Month();
MonthNumber = MonthNumber -1;
sincePrev = abs(DaysToThirdWednesday - 31 + (31 - DaysInMonth(MonthNumber,Year())));
// addcolumn shows that daysinmonth is calculated correctly
// sinceprev = (2 - 31) = -19 + (31 - 31
}
//
if(DaysToThirdWednesday[0] <= 0)
{
// SincePrev = abs(DaysToThirdWednesday + 31 - (31 - DaysInMonth(Month(),Year())));
// UntilNext = abs(DaysToThirdWednesday);
// untilNext = (DaysInMonth(MonthNumber,Year()) - d) + DaysInMonth(MonthNumber,Year());
sincePrev = abs(DaysToThirdWednesday);
}
*/
```

See all the notes.... that is my way trying to troubleshoot, recalculating every step....

It's not unwillingness, it's just a user, and I am pretty sure I am not alone with this, that is having a lot of trouble understanding.

ps: Do understand very clearly that this is not a problem of AB or a problem of AFL, it's a problem of all users that are just not good at this but still would love to use all the AB abilities. Takes a lot more time for them than for many other users

I will continue my journey, thanks again for the help.