Afl Coding based on LTP

For exanple, If LTP is greater than or equal to 30 then buy signal
If LTP is less than or equal to 17 then sell signal

How to write code for this ?