Trend following strategies all work similarly. I’ll use the simplest example. I need coding for the following.
Condition 1: EMA20 crosses over EMA50
After condition 1 is met, I want a counter for condition 2.
Condition 2 means stochastic crosses over 20. There we buy at market.
So AFTER the EMACross, a pullback of the stochastic should be bought, whereby this pullback includes a counter. I want to know how many pullbacks are profitable after an EMACross. Often only the first pullback is profitable, sometimes there are 2 or 3. This counter should therefore be optimisable.
Can someone code this for me please?