If you are still invested in the relationship and secretly having hopes that sex could be the remedy to the issues you both have, then no you should not keep sleeping with your ex. It would be best for you to take time to heal so you can move on to more healthy relationships.