The following pattern of price action is used and one indicator:
The low of previous candle must be higher than 5 period EMA for sell trades and the high must be lower than 5 period EMA for buy trades.
Using AUDCAD as an example with D1 chart below:
The grey rectangles mark the setup candles and the red and blue dotted lines mark the trigger candle to sell a position short or buy a position long upon candle open.
As you can see in this example price moved against the first short position so a second short position is added at the next short setup. Both short positions are then closed at an overall profit at the long setup before a long position is opened.
This is a simple strategy for opening and closing trades at optimal price levels and is straightforward to automate however this is only half the story because taking every signal in this way is unlikely to yield a profit. It is better to pick a direction in which to trade based on higher timeframe analysis and then follow these rules for entry and exit only in that direction or use a suitable trade management strategy for risk management or both.
This page assumes basic trading knowledge/terminology. If anything on this page does not make sense I recommend the following free online school to cover the basics:
If you would like your own expert advisor to trade for you this way or perhaps you have your own trading rules you would like automated then please contact me to discuss.