The FRAMA & CPMA Strategy overlay script combines a Fractal Adaptive Moving Average (FRAMA) and a custom CPMA indicator imported from an external library.
1Copy the scriptPress Copy script above, or the copy button on the code below.
2Open the Pine EditorOpen a TradingView chart and choose Pine Editor at the bottom of the screen.
3Paste over the templateCreate a new strategy, select all of the template text and paste. Press Save and give it a name.
4Add it to the chartPress Add to chart. The trades and results appear in the Strategy Tester tab; adjust the settings with the gear icon.
Source Code
110 lines of Pine Script v5 from 策略/新建文件夹 (2)/FRAMA & CPMA策略[CSM].txt, published under MPL-2.0 (file header). Keep the author's credit and licence lines when you reuse it.
FRAMA & CPMA Strategy [CSM] generates long and short trading signals when price crosses above or below either moving average line. Traders can optionally enable an engulfing candle pattern filter to require bullish or bearish confirmation before entering trades. The strategy includes adjustable fixed stop-loss levels, profit targets, trailing stop parameters, and a custom backtesting date window. Both indicator lines are plotted directly on the main price chart.
Fractal Adaptive Moving Average calculation
Custom CPMA indicator integration
Optional bullish and bearish engulfing filter
Configurable take profit and trailing stop parameters
The inputs you can change from the gear icon on the chart. Defaults are the author's.
Setting
Type
Default
Variable
FRAMA Source
source
close
src
FRAMA Length
int
21
length
Fractal Dimension
float
0.8
fracDim
CPMA Length
int
21
CPMA_length
Enable Engulfing Candle Filter
bool
false
enableEngulfingFilter
Long Take Profit Amount
float
10
longTakeProfit
Short Take Profit Amount
float
10
shortTakeProfit
Trailing Take Profit Amount
float
0.5
trailingTakeProfit
Stop Loss
float
100
LossstratA
Start Date
time
timestamp('01 Jan 2023 03:30 +0000')
start
End Date
time
timestamp('1 Jan 2099 15:30 +0000')
finish
Third-party code. ForexR did not write, test or endorse this script, and the summary above was generated automatically from its code and README. Indicators describe the past, and a strategy's backtest can look better than live trading, especially when a script repaints. Check it in the Strategy Tester and on a demo account before you rely on it.
This strategy trades price action pin bar patterns aligned with moving average trend alignment on the main price chart. It defines uptrends or downtrends using a fan arrangement of three moving averages (6 EMA, 18 EMA, and 50 SMA). Entry conditions require a b
This overlay strategy marks short-term turning points on the price chart and enters SPY option-style trades from them. It plots simple moving averages of highs and lows, draws up and down reversal arrows, and colors bars when a short-term extreme coincides wit
This strategy calculates and plots smoothed Heikin-Ashi candles directly onto the main price chart using exponential moving averages of open, high, low, and close prices. It enters a long position after three consecutive bullish smoothed candles with sequentia
This strategy executes trades based on candlestick engulfing patterns aligned with a 200-period exponential moving average trend filter. It enters long positions when a bullish engulfing candle follows three consecutive bearish candles while price trades above
This strategy shorts the ES three-minute chart when three consecutive down candles form a triple-red pattern and price is above a Tillson-style T3 average. The average is six nested EMAs of close, combined with fixed coefficients and a user length defaulting t
This strategy combines Ichimoku Kinko Hyo components, a Stochastic oscillator, and specific candlestick patterns to generate trade signals. It identifies Kumo twists and range breakouts while evaluating candle body shapes using Fibonacci threshold filters. Tra