I kept messing with the code and the double lines were gone.
Remaining issues:
He no longer creates the vertical lines for the weekly and monthly periods. As almost no one uses graphics in these periods, it is something that will not be missed. For weekly and monthly timeframes, the ideal would be to use the metatrader standard, which is the 1-year interval, but there is no such option in ENUM_TIMEFRAMES.
I still haven't found a way to make him draw the line to close the current period.