I'm trying to understand how to code a strategy where a long or short trade is executed when price touches an SMA or EMA (see attached screenshot).
All I can find is how to code a moving average cross. Instead, I want to backtest/automate a strategy that trades when price touches (or gets within a few ticks) of an EMA or SMA.
Is this possible?
Comment