In need of code to partially close an open trade automatically

 

Fellow trader looking for code which is crucial to trading strategy! 80% return per month that is indicative of code. proven paper trade and in need of online back testing. Please let me know if you can write this or have it available already. thanks!