How to save 'signature move' sensor data

Hi

What i'm trying to do is similar to how the watch unlocks when you twist your wrist towards your face. 

I want in an app to record the movement ( the acceleration, the position and every helpful sensor data for a certain arm movement ) and later match it to occurrences. 

Could somebody point me where to look for guidance, example or is there a open source code for the 'unlocking' app? 

Thanks a lot in advance :)