That would be a good place to start--modifying that code. It's a bit different than these patterns: (reference noted at bottom)
Characteristics of the Pin Bar Formation
• The open and close of the pin bar are within the price range of bar 1 and bar 3 of the formation, or very close to being...