Join waitlist
Strategies / Trend / EMA Stochastic Trend Follow

EMA Stochastic Trend Follow

The strategy buys when the bar trades above the 20-period EMA, the stochastic %K is above its %D line, and the EMA is rising over 20 bars. It sells short on the mirror setup, and exits on a close back through the 20-period EMA.

TrendLong & shortSwingUSD/JPYDaily
1.50Profit factor
2,752,260Net profit USD
31.45%Win rate
690Trades
-461,570Max drawdown
3,989Avg trade

Best run of 4. USD/JPY, Daily, spread 1, from run pf:2026-10-10-USDJPY-D.tsv:12.

Entry rules, long

  1. The raw %K of the 14-period stochastic is above its 3-bar average %D
  2. The 20-period EMA is above its value 20 bars earlier

Entry rules, short

  1. The raw %K of the 14-period stochastic is below its 3-bar average %D
  2. The 20-period EMA is below its value 20 bars earlier

Exit rules

  1. A short is closed when the close rises above the 20-period EMA, unless a long signal fires
  2. An opposite entry reverses the position

Test conditions

PeriodUp to 2026-10-10
InstrumentUSD/JPY, Daily
Spread1 points
Starting capital1,000,000
CostsSpread only. Commissions and overnight financing are not included.
BarsUp to 200,000 bars, fewer where the instrument has less history
Last tested2026-10-10

Every run

Markets and timeframes tested

MarketTimeframePFTradesWin %NetMax DD
USD/JPYBest runDaily1.50 69031.452,752,260 USD-461,570
EUR/USDDailyn/a 65833.13101,897 USD-53,403
GBP/USDDailyn/a 68733.7717,895 USD-6,899
Nikkei 225Dailyn/a 61131.1017,503 USD-16,545

Charts

Results by run

Net profitMax drawdown

The code

ProBuilder code, as tested

// ==============================================================
// EMA Stochastic Trend Follow
// ProRealAlgos Strategy Library  |  prorealalgos.com
// Type: Trend
// Direction: Long & short
// Timeframe tested: Daily
// ==============================================================

DEFPARAM CumulateOrders = false

ONCE myK = 50

hh = highest[14](high)
ll = lowest[14](low)

23 more lines: the entry and exit rules.

Setup

How to load it

  1. Copy the code with the copy button on the code block.
  2. In ProRealTime, open a chart of the instrument and timeframe you want to test, then open ProOrder > New trading system and choose "Create with programming".
  3. Paste the code, give the system a name and save it.
  4. Click "Backtest", set your own spread and position size, and run it before you consider trading it live.

Indicators used

EMAStochastic
Longer historyRe-run on up to 1,000,000 barsUSD/JPY · Daily · older data -10.00 USD

USD/JPY had no history beyond the standard run, so both runs used 12,000 bars.

USD/JPY · Daily

Bars available12,000
Net, standard 200,000-bar run2,752,260.00 USD
Net, long run2,752,250.00 USD
Net on the older data alone-10.00 USD
Read this firstKnown weaknesses2 points
  • The code sets no stop loss, so a losing trade stays open until an exit signal arrives.
  • Results include the spread only. Commissions and overnight financing are not included.

Questions

About this strategy

Can I run EMA Stochastic Trend Follow in ProOrder?

Yes. The code is ProBuilder and runs as an automated ProOrder system. Backtest it on your own account with your own spread and position size before trading it live.

Which markets was it tested on?

It was tested on 4 market and timeframe combinations. The best run was USD/JPY, Daily, with a profit factor of 1.50 over 690 trades.

How large was the drawdown?

The best run had a maximum drawdown of 461,570 USD at the tested position size, against a net result of 2,752,260 USD.

Does it trade long, short or both?

It trades both long and short.

Related

Strategies like this one

Reversal Pattern With Chaikin Volatility

Uses the same indicator.

2.26 PF · 6,872 trades

Trend Surfer

Best run on the same market, USD/JPY.

1.04 PF · 10,813 trades

Moving Average And MACD Long

Also a trend strategy.

1.50 PF · 749 trades

See how ProRealAlgos combines strategies like this into one automated portfolio.

The ProRealAlgos community gets the full rules, the complete code and the automated portfolio.

Past backtest results do not guarantee future results. This is not financial advice. Curated and maintained by ProRealAlgos. ProRealTime™ is a trademark of ProRealTime SAS. prorealalgos.comStatsDocs