It looks like I accidentally stumbled into a scalping strategy. I posted the rules near the top of the page for those that don’t care about how I developed the expert advisor.
Warning: this EA cannot possibly profit on wide spreads. Do not follow this method if your broker’s spread and execution slippage average more than 2 pips.
Scalper EA Trading Rules
Chart: EURUSD 5 minute
SMA Period: 200
Moving Average Envelope: 1.0% of the SMA
Style: Counter-trend scalper
If the price crosses and closes below the lower envelope, then buy at market.
If the price crosses and closes above the upper envelope, then sell short at market.
If the price crosses and closes above the lower envelope, then exit long at market.
If the price crosses and closes below the upper envelope, then exit short at market.
Notice that the scalper strategy uses the same envelope for entry as it does for exit. The distribution of distance around the moving average is sticky when the price extends far away from the SMA.
Get the code for MetaTrader 4 or NinjaTrader
Why the strategy works
The original intent for this research sought to uncover a range trading strategy based on the price crossing the moving average. Most traders think of distance in terms of pips.
Pips are valid for general context. The problem with modeling a strategy based on pips is that the the meaning of one pip’s movement changes over time.
Taking the idea to extreme lengths, the value of a pip in 1999 when the euro launched around 0.80 hardly compares with today’s price of 1.30. Keeping the discussion to percentages helps to fix the meaning of an idea like 100 pips over long periods of time.
I wanted to visualize how the price generally behaves relative to the moving average. A custom NinjaTrader indicator that my programming team wrote collects and analyzes the data in an Excel spreadsheet. Excel allows me to draw a graph of how frequently the price stretches away from the 200 period simple moving average.
The slope of the curve bends as the price extends further from the moving average. As you move left to right along the horizontal axis, the slope is steep until 0.75%. A kink in the curve forms at that point. The slope of the line flattens substantially from that point onward.
A big slope implies that the price will be anywhere but here on the next bar. A flat line means that the price isn’t likely to go anywhere. The distance is sticky at that level.
Scalping in a moving market doesn’t make sense. It’s only when we identify the sticky price condition of 1% away from the moving average that running a scalper EA makes sense.
Scalper EA Backtest results
I developed the strategy in NinjaTrader using data from 2011. My blind period was 2012, which was data that the strategy never saw in development. It was a pure walk forward test.
Results without spread costs
Profit: $5,740 on 108 trades trading 1 standard lot per signal
Profit factor: 2.18
Percent accuracy: 83.33%
Results with 2 pip spread costs
Profit: $1,420 on 108 trades trading 1 standard lot per signal
Profit factor: 1.24
Percent accuracy: 65.74%
The scalper EA is incredibly sensitive to two assumptions: spread and slippage. I assume that anyone following this methodology trades at a reputable broker with good execution. The backtests assume that the combined cost of both spread and average slippage is 2 pips.
If your broker does not provide execution and spreads within that 2 pip window, then do not trade this strategy. I would not expect for you to walk away a winner.
Walk forward results without spread costs
Profit: $1,960 on 34 trades trading 1 standard lot per signal
Profit factor: 4.38
Percent accuracy: 88.24%
What is scalping?
Scalping refers to a short term trading style. Profits are very small and occur a large percentage of the time. When losses happen, they tend to be several times larger than a typical winner.
The high number of wins attracts traders of all stripes. The idea of consistently earning profits makes trading more fun and appealing. Traders with experience, which inevitably means traders that have suffered losses, also find the high percentage win rate appealing. It makes the emotional suffering far less difficult.
The emotional component that attracts traders to scalping strategies leads to illogical business decisions. Traders place the need to win frequently above the long term need to expect a profit.
Too many scalping expert advisors tap into the high winning percentage. Most fail to present a clear and obvious reason why it makes sense to scalp.
The EURUSD typically costs $2 to trade a mini lot. Many scalpers set narrow profit targets between 1-5 pips, which are worth $1-5.
The trader spends $2 to make $1-5. If this were a normal business, that would be the end of the game. You win. The game is only limited by the number of trades placed.
Trading, unlike other businesses, frequently results in losses. It’s very possible to build an expert advisor that could win trading for free but loses when costs enter the picture.
The best example is the difference in the scalper EA backtests for 2011. The first test showed a percent accuracy of 83% without including the spread. Adding the spread to the second backtest decreased the accuracy to 65%.
The accuracy dropped because all trades had to subtract the spread cost from their simulated winnings. The number of trades that flipped from profit to loss because of a 2 pip spread shows how many trades profited by the narrowest of margins. The narrower the margin of profit, the more sensitive a strategy becomes to spread costs.
Do you think that I should have considered other ideas in the strategy? Suggest some ways to improve in the comments section below.
This series eventually led to a profitable trading strategy. If you’d like to read through the journey, then I suggest reading the articles sequentially
The initial strategy idea
Selecting an appropriate time frame
A research plan
An annoying surprise in the initial backtests
An attempt at range trading
Range trading results
The moving average envelope scalper