How would we code entering a trade on a SMA cross (trivial) and exit on an SMA cross for that given trade?

Would it be enterLong(exitLong(price=my_exit_price))?

And then define int my_exit_price = SMA(Price)?