how to find Values of pitchfork


I am writing an EA that uses pitchfork. the higher and lower Lines for interring  and the middle Line for Exiting position.

as you know unlike Fibo Lines that are flat and the price of them is set in the EA, pitchfork is not flat. it is always upward or downward.

problem is how can i wright in coding Language that you should Buy when price is near the Lower Line, and Sell when price is near the Higher Line?

i mean we dont know in one hour what price the Higher Line or the Lower Line are going to have, because the fork is not Flat.

any ideas?