Strategy vault / Trend following
EMA Crossover Intraday Trading Strategy Based on AO Oscillator
This is an intraday trading strategy that utilizes the AO oscillator and EMA crossovers to generate trading signals. The main idea is to enter trades when the AO crosses its zero line concurrently with the fast EMA…

Overview
This is an intraday trading strategy that utilizes the AO oscillator and EMA crossovers to generate trading signals. The main idea is to enter trades when the AO crosses its zero line concurrently with the fast EMA crossing over the medium-term EMA line.
Strategy Logic
The strategy mainly relies on two indicators for entries and exits:
AO Oscillator: It measures the difference between 5-period and 34-period HL2 averages to gauge current trend direction. Positive AO represents an upward trend while negative AO signals a downward trend.
EMA Crossover: The strategy uses a 3-period EMA for short-term trend and a 20-period EMA for medium-term trend direction. A golden cross with the 3EMA moving up through the 20EMA generates buy signals while a death cross with the 3EMA crossing down through the 20EMA produces sell signals.
Trades are entered only when the AO crosses its zero line concurrently with an EMA crossover. This avoids wrong signals when the AO is oscillating. Exits happen after the London session closes by flattening all positions.
Advantage Analysis
The main advantages of this strategy are:
- AO oscillator ensures accurate trend direction for reliable signals;
- Dual-indicator combo filters out noise for high-confidence signals;
- Trading only during major sessions avoids overnight risks;
- Simple and clear logic makes it easy to understand and implement;
- No optimization or curve-fitting needed with stable parameters.
Risk Analysis
Some risks to note include:
- Risk of extended losses without timely stop-loss in black swan events;
- Whipsaws from false EMA crossovers in ranging markets;
- Lack of adaptiveness from fixed parameters across changing market cycles.
Risks can be mitigated via stop losses, adaptive parameters tuned to varying cycles etc.
Optimization Directions
Main optimization directions are around parameter tuning:
- Adjust EMA periods to test shorter-term combos or additional EMAs in signal generation;
- Tune AO parameters to assess impact on the oscillator;
- Add supplementary indicators like RSIbord to avoid overbought/oversold conditions;
- Adjust trading session timings to test different regions or longer durations.
Parameter tweaks and additional filters can enhance the strategy's robustness and efficiency.
Conclusion
In summary, this intraday trading tactic combines the AO trend gauge with EMA crossovers to craft a simple yet practical approach. It has clear signals that are easy to implement but lacks adaptive parameters. Further testing and refinements can improve its stability and alignment with varying market landscapes. Overall it presents retail intraday traders with an excellent choice.
Parameters
| Name | Default | What it controls |
|---|---|---|
| v_input_1 | 3 | Length |
| v_input_2_close | 0 | Source: close | high | low | open | hl2 | hlc3 | hlcc4 | ohlc4 |
| v_input_3 | 20 | Length |
| v_input_4_close | 0 | Source: close | high | low | open | hl2 | hlc3 | hlcc4 | ohlc4 |
| v_input_5 | false | Reverse position ? |
Source Pine Script
/*backtest
start: 2022-12-18 00:00:00
end: 2023-12-24 00:00:00
period: 1d
basePeriod: 1h
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=4
//@author SoftKill21
strategy(title="MA cross + AO", shorttitle="MA_AO")
ao = sma(hl2,5) - sma(hl2,34)
len = input(3, minval=1, title="Length")
src = input(close, title="Source")
out = ema(src, len)
len1 = input(20, minval=1, title="Length")
src1 = input(close, title="Source")
out1 = sma(src1, len1)
timeinrange(res, sess) => time(res, sess) != 0
londopen = timeinrange(timeframe.period, "0300-1100")
nyopen = timeinrange(timeframe.period, "0800-1600")
longC = crossover(out,out1) and ao>0 and londopen
shortC = crossunder(out,out1) and ao<0 and londopen
invert = input(title="Reverse position ?", type=input.bool, defval=false)
if(invert==false)
strategy.entry("LONG",1,when=longC)
strategy.entry("SHORT",0,when=shortC)
if(invert==true)
strategy.entry("short",0,when=longC)
strategy.entry("long",1,when=shortC)
strategy.close_all(when= not (londopen))
Published by ChaoZhang on the FMZ strategy square · last modified 2023-12-25. Collected in the Quant Trading Vault. Unvalidated research: re-test with your own data and costs before trusting it.
Build this with AgenKit
A spec is not a trading system. Paste this into your coding agent and AgenKit runs a specialist team — architecture, test-first build, risk gates, review — with paper trading on by default.
/agenkit build a production-grade trading bot with a backtest engine, risk controls and paper trading by default from strategies/EMA-Crossover-Intraday-Trading-Strategy-Based-on-AO-Oscillator.md- npx agenkit install engineering-kit in your project
- Paste the command into your agent and approve each phase
- Get tests, backtest, risk controls and a paper-trading switch
Understand it first
Before you run this, read the lesson behind the idea and how to backtest it honestly. Specs like this one are the survivors of an unknown number of trials; deflate their results accordingly.
Related specs
- ADX MA and EMA Long Only Trend Tracking StrategyPine Script · Trend following · 1d
- ATR and Moving Average Crossover Hybrid StrategyPine Script · Trend following · 1h
- Bollinger Band Moving Average Crossover StrategyPine Script · Trend following · 1h
- Bollinger Bands and EMA Trend Following StrategyPine Script · Trend following · 1h
- Bollinger Bands and RSI Trend Following StrategyPine Script · Trend following · 1h
- Candlestick Pattern Trend Filter StrategyPine Script · Trend following · 1d