FX Strategy Based on Fractal Waves and SMMA
This strategy combines fractal wave theory and SMMA to identify trend opportunities, and uses proper stop loss and trailing stop to control risks for profit maximization. It only enters positions during specified…

Overview
This strategy combines fractal wave theory and SMMA to identify trend opportunities, and uses proper stop loss and trailing stop to control risks for profit maximization. It only enters positions during specified trading sessions to avoid market swings at certain times.
Strategy Logic
- Use SMMA to calculate average price and filter market noise for trend direction
- Identify trend reversal points using highest/lowest price within certain periods as fractal waves
- Go short when price wave breaks above SMMA, go long when breaks below
- Set stop loss and trailing stop based on ATR to control risks
- Only trade within specified sessions, avoiding weekend and intraday swings
Advantage Analysis
- Fractal wave theory accurately identifies trend reversal points, combined with SMMA for trend direction
- Stop loss and ATR trailing stop effectively limits loss per trade
- Only trading during liquid sessions avoids excessive slippage and volatility
- Following parabolic SAR strictly to exit at reversal signal maximizes profit
Risk Analysis
- Inaccurate fractal wave may cause whipsaws in non-trending periods
- SMMA lag may miss ideal trend reversal points
- Stop loss too tight may get stopped out easily, too loose may incur larger loss
- Fixed profit taking unable to adjust to different market conditions
Solutions:
- Optimize parameters for fractal period and SMMA
- Add Stochastics to confirm reversal signals
- Dynamically optimize stop loss, profit target
Optimization Directions
- Optimize fractal period and SMMA parameters
- Add Stochastics indicator to filter false breakouts
- Experiment with dynamic stop loss and profit taking
- Widen stop loss to avoid getting stopped out
- Optimize parameters for different products and trading sessions
Summary
This strategy integrates fractal wave theory and SMMA to identify trend and reversal points to trade, with proper stop loss and profit taking. It can be further improved by optimizing parameters and adding confirming indicators for higher stability and profitability.
Parameters
| Name | Default | What it controls |
|---|---|---|
| v_input_1 | 30 | SMMA Period |
| v_input_2 | 7 | Stop Loss % |
| v_input_3 | 2.7 | Trailing Stop Coefficient |
| v_input_4 | 5 | Fractal Period |
Source Pine Script
/*backtest
start: 2022-11-12 00:00:00
end: 2023-11-12 00:00:00
period: 1d
basePeriod: 1h
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=4
strategy("FX Strategy Based on Fractals and SMMA", overlay=true)
// パラメータ
SMMAPeriod1 = input(30, title="SMMA Period")
StopLoss1 = input(7, title="Stop Loss %")
TrailingStopCoef1 = input(2.7, title="Trailing Stop Coefficient")
fractalPeriod = input(5, title="Fractal Period")
// SMMAのCalculation Function
smma(src, length) =>
var float smma = na
if na(smma[1])
smma := sma(src, length)
else
smma := (smma[1] * (length - 1) + src) / length
smma
// フラクタルのApproximation
highFractal = high[2] > high[1] and high[2] > high[3] and high[2] > high[4] and high[2] > high
lowFractal = low[2] < low[1] and low[2] < low[3] and low[2] < low[4] and low[2] < low
// エントリーcondition
longEntrySignal = lowFractal and close[1] < smma(close, SMMAPeriod1)
shortEntrySignal = highFractal and close[1] > smma(close, SMMAPeriod1)
// エントリーExecute
if (longEntrySignal)
strategy.entry("Long", strategy.long)
if (shortEntrySignal)
strategy.entry("Short", strategy.short)
// トレーリングストップのCalculate
atrValue = atr(10)
longStopPrice = close - atrValue * TrailingStopCoef1
shortStopPrice = close + atrValue * TrailingStopCoef1
// トレーリングストップのSettings
strategy.exit("Exit Long", "Long", stop=longStopPrice)
strategy.exit("Exit Short", "Short", stop=shortStopPrice)
// バックテストPeriodのSettings(MetaTraderのバックテストとSame asじPeriod)
startYear = 2007
startMonth = 05
startDay = 01
endYear = 2022
endMonth = 04
endDay = 01
startDate = timestamp(startYear, startMonth, startDay, 00, 00)
endDate = timestamp(endYear, endMonth, endDay, 23, 59)
// バックテストDuring the periodでのみトレードをExecute
if (time >= startDate and time <= endDate)
if (longEntrySignal)
strategy.entry("Long", strategy.long)
if (shortEntrySignal)
strategy.entry("Short", strategy.short)
Published by ChaoZhang on the FMZ strategy square · last modified 2023-11-13. 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/FX-Strategy-Based-on-Fractal-Waves-and-SMMA.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
- Quantitative Strategy PSARZigZagMACDART Based on Multi Indicator CombinationPine Script · Breakout · 1m
- Dynamic Stop Loss Strategy Adaptive to ATR FluctuationsPine Script · Breakout · 1h
- Quantitative Trading Price Breakthrough StrategyPine Script · Breakout · 1d
- Quantitative Trading Strategy Based on Ichimoku with Multiple SignalsPine Script · Breakout · 1h
- Reversal Breakout StrategyPine Script · Breakout · 1d
- Multi Level ZigZag Percentage Retracement with Stochastic Trading StrategyPine Script · Breakout · 5m