Strategy vault / Mean reversion
Gold Standard Quantitative Trading Strategy
This strategy is a trading strategy based on the crossover of the 30-day and 200-day moving averages. It runs on the XAUUSD gold 1-minute chart to capture short-term price trends. The strategy also uses stop loss and…

Overview
This strategy is a trading strategy based on the crossover of the 30-day and 200-day moving averages. It runs on the XAUUSD gold 1-minute chart to capture short-term price trends. The strategy also uses stop loss and take profit settings to manage risk.
Strategy Principle
The strategy uses the crossover of the 30-day and 200-day moving averages as trading signals. It goes long when the 30-day moving average crosses above the 200-day moving average, and goes short when the 30-day moving average crosses below the 200-day moving average. In addition, when a reverse signal appears, the current position will be closed, and a new position will be opened according to the direction of the new signal.
The strategy combines the advantages of trend tracking and moving average crossover. The 30-day MA can respond to price changes faster, while the 200-day MA has stronger trend filtering. Their crossover provides clear signals for entering and exiting the market. At the same time, it uses reverse opening to lock in profits and avoid large losses during price consolidation.
Advantage Analysis
- Improves signal reliability by using double moving average crossover
- Reverse opening mechanism helps avoid losses caused by consolidation
- Setting stop loss and take profit is beneficial for risk control
- Can be used in multiple time frames
- Easy to improve effectiveness through parameter optimization
Risk Analysis
The main risks facing this strategy are:
- Higher probability of false signals from double MAs, may cause frequent trading, increasing trading costs and slippage risks
- Ignores underlying fundamentals of trading instrument, overlooks inherent logic of price fluctuations
- No capital management rules set to control per trade risk exposure
Risks can be reduced by:
- Adding filters to avoid frequent signal reversal
- Combining fundamental analysis of trading instrument
- Introducing capital management module to limit per trade position sizing
Optimization Directions
The strategy can be optimized in the following aspects:
- Test different parameter combinations of MAs to find the optimal parameters
- Add other indicators for filtration, such as volume, volatility indicators, etc.
- Introduce adaptive stop loss mechanism to adjust stops based on market volatility
- Implement capital management rules to limit per trade position sizes
- Conduct backtesting optimization to find optimal parameter combinations
Conclusion
The overall operation of the strategy is smooth and the core trading logic is clear and simple. It generates trading signals using double MA crossovers, and uses reverse opening to lock in profits. This trading method can avoid significant losses during price consolidation. Setting stop loss and take profit also facilitates risk control. However, the strategy also has some flaws, mainly manifested as frequent signals while overlooking price fluctuation fundamentals. By introducing filtration conditions, capital management modules, and parameter optimization, risks can be reduced and the stability and profitability of the strategy can be improved.
Source Pine Script
/*backtest
start: 2024-01-01 00:00:00
end: 2024-01-31 23:59:59
period: 1h
basePeriod: 15m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=5
strategy("Estrategia de Cruce de Medias Móviles", overlay=true)
// Medias móviles
ma30 = ta.sma(close, 30)
ma60 = ta.sma(close, 60)
ma200 = ta.sma(close, 200)
// Cruce de medias móviles
crossoverUp = ta.crossover(ma30, ma200)
crossoverDown = ta.crossunder(ma30, ma200)
// Señales de compra y venta
longCondition = crossoverUp
shortCondition = crossoverDown
// Ejecución de órdenes
if (longCondition)
strategy.entry("Buy", strategy.long)
strategy.exit("Cover", "Buy", stop=close - 40.000, limit=close + 40.000)
if (shortCondition)
strategy.entry("Sell", strategy.short)
strategy.exit("Cover", "Sell", stop=close + 40.000, limit=close - 40.000)
// Plot de las medias móviles
plot(ma30, color=color.blue, title="MA 30")
plot(ma60, color=color.orange, title="MA 60")
plot(ma200, color=color.green, title="MA 200")
// Condiciones para cerrar la posición contraria
if (strategy.position_size > 0)
if (crossoverDown)
strategy.close("Buy")
if (strategy.position_size < 0)
if (crossoverUp)
strategy.close("Sell")Published by ChaoZhang on the FMZ strategy square · last modified 2024-02-26. 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/Gold-Standard-Quantitative-Trading-Strategy.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
- 3 10 Oscillator Profile Flagging StrategyPine Script · Mean reversion · 1d
- A Trend Reversal Strategy Based on Moving Averages Price Patterns and VolumePine Script · Mean reversion · 1d
- Adaptive Mean Reversion Trading Strategy Based on Chande Momentum OscillatorPine Script · Mean reversion · 1d
- Adaptive Trading Strategy Combining Dynamic Trend Reversal and Stochastic IndicatorPine Script · Mean reversion · 1d
- Advanced 15 Minute Chart Trading Signal StrategyPine Script · Mean reversion · 3h
- Advanced Momentum EMA Trend Following with RSI Overbought Oversold Trading StrategyPine Script · Mean reversion · 1d