i have attached two images, one with code snippet and the other with mt4 chart. can you kindly help me understand why this code bought at the start of current bar. my intention is that if two bars are formed on the long trend then it buys.

Attached Files mt4.PNGcode.PNG