Buy on a stop!

 
Does anyone have an EA or script that will buy or sell on a stop order at the high or low of the previous bar? It sounds easy, but I've searched for hour and can't find anything. Thanks for your help, Jim
Reason: