4TF Heiken Ashi with arrow

 
Hi, I want to made an EA based on 4TF Heiken Ashi indicator. When the first green arrow appear, BUY direction start and when the first red arrow appear, SELL direction start. Really appreciate someone show me how to code this, thanks.
Reason: