Topic: Closing my position immediately

I like to know how I can close immediately my positions when the conditions I had programed are fulfilled.
For example the condition was reached but the system will close the deal at the end of the current bar
or at the begining of the next one. I would like to close the deal after several tics or minutes because if the conditions are met when the bar begins and we are in 30 m period; then I will lose during long term before
the system close my position. What can I do to solve this issue?