Thank you for your answer, I will try it but firstly I will see to configure Squid in Ubuntu and test it than I will configure rules in mikrotik, it was not clear for me if I must have two interfaces in squid as I see I can use it with one interface.
I will see for squid configuration.
I need help about how to implement external cache+transparent proxy in Mikrotik with 3 interfaces as in the picture, and PPPoE users, any one can help me what rules to create, any suggestions.