Please help to write AFL code.

I Fixed bar N(0) and use a High and Low Value as a Reference Value then the next 11 bar are N(1)....N(2)......N(3).....to..........N(11) .

We would like system generate "BUY" signal when High value of any 11 bar (N(1) or N(2) or N(3)..........N(11) Greater than High Value of Reference Bar N(0) and in other way We would like system generate "SELL" signal when Low value of any 11 bar (N(1) or N(2) or N(3)..........N(11) Less than Low value of Reference Bar N(0)

Note : The Reference bar N(0) is the last trade bar of month .

Regards;