Placing a pending order when a pre-set level is reached

 
Hello
I'm looking for a script that meets the following condition:
When the pre-set price level is reached, a pending order is automatically placed. The entrance of the pending order must be at a distance from the reached level. The distance is set via the script settings.
Reason: