Flags form when the market retraces during trending conditions and are used as trend continuation patterns.
The counter trend movement creates a small channel, when price breaks the channel in the direction of the trend, the continuation trade is triggered.