Need help creating close order

 

Can anyone help me create a close order in my ea because I'm at loss in what i should do.

Example, I have open buy and the condition to close  the order is fulfilled (CCI<0). How do i write in in my ea. Thank you.