Topic: week closing indicator

I need help to understand that simple part of code and how the calculations results = friday close !!!1


// Calculation of the logic
            for (int iBar = 0; iBar < Bars - 1; iBar++)
            {
                if (Time[iBar].DayOfWeek > DayOfWeek.Wednesday &&
                    Time[iBar + 1].DayOfWeek < DayOfWeek.Wednesday)
                    adBars[iBar] = Close[iBar];
                else
                    adBars[iBar] = 0;
            }

Regards

Re: week closing indicator

if (Time[iBar].DayOfWeek > DayOfWeek.Wednesday
// if the current bar is Thursday, Friday, or Saturday

&&
// and -- both of these must be true to activate

Time[iBar + 1].DayOfWeek < DayOfWeek.Wednesday)
// if the next bar in the future is Sunday, Monday, or Tuesday

adBars[iBar] = Close[iBar];
// the exit price is the close of the current bar
// This works because only the last bar of the week will be Thursday or Friday with the next bar as
// Sunday or Monday.

else
      adBars[iBar] = 0;
// All other bars are set to exit price of 0 -- this means they do not exit the position.


Does this work in FST? Since it looks for [iBar+1], I don't think it would work (but I don't know), it is like looking into the future.
I think it is better to use Exit Day and Exit Time. Set Exit Day to end of your week, then Exit Time to cover 2-3 hours before time of your week's closing, to be sure it closes. If the exit time is not wide enough, it is possible FST would miss the bar and not exit at the end of the week.