Strategy vault / Trend following
1 Profit Moving Average Cross Strategy
This strategy generates buy signals when a fast moving average (Fast MA) crosses above a slow moving average (Slow MA). It also takes profit when the returns reach 1% to lock in small but consistent profits. The…

Overview
This strategy generates buy signals when a fast moving average (Fast MA) crosses above a slow moving average (Slow MA).
It also takes profit when the returns reach 1% to lock in small but consistent profits.
The strategy works well in trending markets with clear trends. It can capture medium-term up trends and achieve steady profits.
Strategy Logic
The strategy is based on the golden cross of moving averages. Moving averages reflect the medium-term trend of stock prices. When the short-term MA crosses above the longer-term MA, it signals that the short-term upward momentum is stronger than the long-term trend. This is a strong buy signal.
The fast MA in this strategy has a length of 10 days and the slow MA is 30 days. This can capture reasonable trend movements. A long signal is triggered when the fast MA crosses above the slow MA.
The strategy also sets a 1% take profit point. Positions will be closed when the returns hit 1% to lock in profits. This helps avoid losses from trend reversals.
Strength Analysis
The strengths of this strategy are:
- Simple to understand and implement with moving average indicators.
- Fast and slow MA combo effective at identifying medium-term trends.
- 1% profit target controls risks and locks in consistent gains.
Overall the strategy is quite robust and can achieve steady profits in trending markets.
Risk Analysis
There are also some risks to consider:
- More whipsaws and stop loss triggers in range-bound markets without clear trends.
- Ineffective in complex non-trending markets.
- No stop loss so vulnerable to huge sudden losses in volatile markets.
To address these risks:
- Add other indicators like Bollinger Bands, KDJ for better signal accuracy.
- Dynamically adjust MA parameters to adapt to changing market conditions.
- Add reasonable stop loss points to control downside on losing trades.
Optimization Opportunities
Some ways to optimize this strategy:
- Test more fast and slow MA parameter combinations to find optimal settings.
- Add stop loss. For example, cut loss when trade drops 3%.
- Combine with other indicators like MACD, KDJ to form multifactor models and improve signal accuracy.
- Utilize auto-optimization methods to find the best parameter combinations.
Conclusion
The strategy is a typical moving average crossover system. It identifies medium-term trends using fast and slow MA, taking 1% profit along the way. Strengths include simplicity and the ability to ride uptrends for steady gains. Weakness is poorer adaptation to complex, volatile markets. By optimizing with more indicators and stop loss mechanisms, the strategy can achieve more robust performance.
Parameters
| Name | Default | What it controls |
|---|---|---|
| v_input_1 | 10 | Fast MA Length |
| v_input_2 | 30 | Slow MA Length |
| v_input_3 | true | Profit Percentage |
Source Pine Script
/*backtest
start: 2023-01-01 00:00:00
end: 2023-06-15 00:00:00
period: 3d
basePeriod: 1d
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © pleasantHead5366
//@version=4
strategy("1% Profit Strategy", overlay=true)
// Input parameters
fastLength = input(10, title="Fast MA Length")
slowLength = input(30, title="Slow MA Length")
profitPercentage = input(1, title="Profit Percentage")
// Calculate moving averages
fastMA = sma(close, fastLength)
slowMA = sma(close, slowLength)
// Plot moving averages on the chart
plot(fastMA, color=color.blue, title="Fast MA")
plot(slowMA, color=color.red, title="Slow MA")
// Trading logic
longCondition = crossover(fastMA, slowMA)
if (longCondition)
strategy.entry("Buy", strategy.long)
// Close long position when profit reaches 1%
if (strategy.position_size > 0)
strategy.exit("Take Profit", from_entry="Buy", profit=profitPercentage / 100)
// Plot Buy and Sell signals on the chart
shortCondition = crossunder(fastMA, slowMA)
if (shortCondition)
strategy.entry("Sell", strategy.short)
Published by ChaoZhang on the FMZ strategy square · last modified 2023-12-06. 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/1-Profit-Moving-Average-Cross-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
- Bollinger Bands and RSI Trend Following StrategyPine Script · Trend following · 1h
- EMA and RSI Trend Trading StrategyPine Script · Trend following · 1d
- Multi Indicator Trend Following Strategy with Dynamic Risk ManagementPine Script · Trend following · 2h
- Relative Volume Trend Following Trading StrategyPine Script · Trend following · 1d
- Trend Following Strategy Based on EMA and SMA CrossoverPine Script · Trend following · 1h
- Dual Rail Trend Tracking StrategyPine Script · Trend following · 3h