I have read every post of this thread. I will be glad to help periodically on your EA.
I am a beginner-intermediate MT4 coder.
The first thing I did with your code is just clean it up and aligned it for readability.
I made no other changes.
I note that the code throws multiple warnings for different reasons such as type casting, and other function errors.
I believe I can clean up all warnings, so that the code compiles with no warnings on next pass if ok with you.
Would you like me to resolve all warnings?
Please take a look at this version and see if you like it: