Need help with EA

 
I need help adjusting this EA. Currently it enters using market order. Would like to adjust buy entry as stop of last (n) bar high and adjust closing order as last (n) bar low after trigger. Also would like to adjust sell entry as stop of last (n) bar low and adjust closing order as last (n) bar high after trigger. I would like the (n) for entry and exit as a variable so I can adjust.
Files:
Reason: