The one at this point that can tell you to leave is the bank by giving you a notice, but the new owners will also have the same right to tell you to leave as well. Your contract will not matter at that point.
Hi Enrique, Who asked you to leave? If it was the bank that foreclosed you have a certain amount of time to leave. Each state is different look up you tenant laws in your county/state to know what your rights are.