The idea
This open-source script is published by officialjackofalltrades as “Confluence Engine Strategy [JOAT]”, short title CES [JOAT]. The trigger is simple: a linear-regression line of the close crossing its own moving average. A trade is taken only if several other tests agree at the same time — the fast and slow EMA trend, the same EMA pair on a second timeframe, volume, a volatility “trending” state, and a 0–100 confluence score that clears a threshold. It is not a lone moving-average cross.
The publication chart is CRYPTO:BTCUSD on the 4-hour timeframe, so this page is filed under BTC. The script does not hard-code a symbol and will load on other charts, but the write-up and the figure follow the author’s main chart. One warning up front: the parameter notes and scoring description on the publication page do not match the current source. The page still talks about a 21-bar regression, a score floor of 60, and a daily higher timeframe; the source defaults are 9, 50, and “60” (60 minutes). Everything below follows the source defaults, not the page copy.

Indicators
- Linear regression: ta.linreg is applied to the open and the close with LR Length, default 9. The signal line is an SMA of the regression close, default length 5. Crosses use the regression close against that signal line, not the raw close.
- Trend EMAs: a 20-period fast EMA and a 50-period slow EMA by default. Fast above slow is an uptrend; the opposite is a downtrend. Both lines are plotted.
- Volatility state: ATR(14) divided by ATR(50). With the regime filter on, entries are allowed only when this ratio is above 0.85. When the ratio falls below 0.85 × 0.75 (about 0.6375), the background is tinted as compression. That tint is visual only and is not a separate entry rule.
- Volume: by default the current volume must exceed the 20-period volume average times a multiplier (default 1.0). The score uses a separate, hard-coded rule: 20 points when volume is above 1.2 times the average, 10 points when it is merely above the average.
- RSI: 14-period by default. Longs also need RSI below 72; shorts need RSI above 28. That only blocks extreme readings; it is not a classic buy-oversold, sell-overbought rule.
- Bias timeframe: the input is labelled HTF Bias Timeframe and defaults to the string “60”, meaning 60 minutes. request.security(..., lookahead_off) computes the same fast and slow EMAs on that timeframe. Fast above slow is a bullish bias. The author’s chart is 4-hour, so if you leave the default alone, this “higher-timeframe” bias actually comes from the shorter 1-hour chart. To use a true higher timeframe, change the input, for example to D.
- Confluence score (0–100): for a long, an uptrend adds 25, a bullish bias 20, volume 0, 10 or 20 as above, RSI below 50 adds min((55 − RSI) × 0.5, 20), and a trending state adds 15. Shorts are symmetric; the RSI points apply only when RSI is above 50. The score on the signal bar must reach the threshold, 50 by default.
- Warm-up: bar_index must reach max(slow EMA length × 2, regime ATR length × 2), 100 bars with the defaults, before any entry. Entries and trend-flip exits also require barstate.isconfirmed, so they wait for the close.
Entry rules
- Long (order name Long, comment CES L plus the score): the regression close crosses above the signal line, the fast EMA is above the slow EMA, the bias timeframe is bullish, the volume test passes, RSI is below 72, the market is in a trending state, the long score is at least 50, longs are enabled, warm-up is over, and the bar is confirmed.
- Short (order name Short, comment CES S plus the score): the regression close crosses below the signal line, the fast EMA is below the slow EMA, the bias timeframe is bearish, the volume test passes, RSI is above 28, the market is in a trending state, the short score is at least 50, shorts are enabled, warm-up is over, and the bar is confirmed.
- A new trade is opened only when the strategy is flat. There is no pyramiding and no reversing from an open position.
- After an exit, the script waits a cooldown of 3 bars by default before it can enter again.
Exits and position sizing
- The take-profit and stop are frozen from ATR(14) at entry. A long targets the average entry plus 2.5 times that ATR and stops at the average entry minus 1.5 times; shorts are mirrored. These are placed with strategy.exit as a limit and a stop.
- Timeout: if neither the target nor the stop is hit within 20 bars by default, strategy.close exits at market with the comment Timeout. On the author’s 4-hour chart that is 80 hours.
- Trend-flip exit: a long is closed when the fast EMA falls below the slow EMA on a confirmed bar; a short is closed when the fast EMA rises back above the slow EMA. The comment is Trend Flip.
- The strategy declaration sizes orders at 5% of equity (default_qty_value=5), with 0.05% commission per side and 2 ticks of slippage. There is also a Risk Per Trade (%) input, default 5, but the current source never reads it, so changing that input does not change size.
- A table in the top-right corner shows tester net P&L, win rate and trade count. Those figures come from the tester on whatever chart you load; they are not Coinpred results, and this article does not quote them.
Inputs (source defaults)
| Input | Default | Purpose |
|---|---|---|
| LR Length | 9 | Linear-regression length, applied to the open and the close. |
| LR Signal Length | 5 | SMA length of the regression close, used for crosses. |
| Fast EMA / Slow EMA | 20 / 50 | Defines the trend, and the same lengths are used on the bias timeframe. |
| ATR Length | 14 | ATR frozen at entry for the stop and target, and the numerator of the volatility ratio. |
| Regime ATR Length | 50 | ATR used as the denominator of the volatility ratio. |
| Min Confluence Score | 50 | Minimum confluence score required to enter. |
| Trade Long / Trade Short | true / true | Allows long or short entries. |
| Require Volume Spike | true | Requires volume above the average times the multiplier. |
| Volume SMA Length / Multiplier | 20 / 1.0 | Volume average length and multiplier. The 1.2× bonus inside the score is hard-coded and ignores this multiplier. |
| RSI Length | 14 | RSI period. |
| RSI Max for Longs / Min for Shorts | 72 / 28 | Longs need RSI below 72; shorts need RSI above 28. |
| Cooldown Bars After Exit | 3 | Bars to wait after an exit before a new entry. |
| Regime Filter / Threshold | true / 0.85 | When on, the ATR ratio must be above 0.85 to enter. |
| Risk Per Trade (%) | 5.0 | Declared but unused in the current source. Actual size comes from the strategy declaration, 5% of equity by default. |
| SL (ATR x) / TP (ATR x) | 1.5 / 2.5 | Stop and target distances in entry ATR units. |
| Timeout Exit (bars) | 20 | Close the trade after this many bars if it is still open. |
| HTF Bias Timeframe | 60 | Timeframe for the EMA bias, default 60 minutes. On a 4-hour chart that is not a higher timeframe. |
| Show Signal Labels / TP/SL Levels | true / true | Toggles entry labels and the take-profit/stop lines. |
Things to know before using it
- The publication page’s parameter and scoring notes do not match the current source. Trust the source and the table above, not the page’s 21-bar regression or score floor of 60.
- The bias timeframe defaults to 60 minutes. If you add the script to the author’s 4-hour chart and leave that input alone, the so-called higher-timeframe bias is coming from the shorter 1-hour chart.
- Risk Per Trade (%) is unused; changing it does not change size. The live default is 5% of equity in the strategy declaration. Size changes drawdown a lot; tester totals are not a live forecast.
- The script does not pin a symbol. The author’s chart is BTCUSD, 4-hour. Other venues, coins or timeframes need their own review, especially the bias timeframe input.
- The stop is 1.5 times entry ATR, which can still be wide in bitcoin. The timeout counts bars, not clock hours.
Installing it on TradingView
- Download the .pine file from Coinpred (active membership required, see below), or check the original page for a newer version.
- Open the Pine Editor, create a blank script, paste the full source, and save.
- Click Add to chart. To follow the author’s display, start with BTCUSD on the 4-hour chart, and decide whether to point the bias timeframe at a true higher timeframe.
- Check size, the ATR multiples and the score threshold, then review fills in the Strategy Tester.
- Past tester results do not guarantee future returns. Do not lean on the dashboard’s win rate or P&L either.
About backtest figures
Source, license and version
- Source: https://www.tradingview.com/script/4W7XgwiP-Confluence-Engine-Strategy-JOAT/
- Author: officialjackofalltrades. Source version 1.0 (Pine v6), scriptAccess=open_no_auth.
- License: Mozilla Public License 2.0. Redistribution must keep the copyright and license notices; modified files must remain under MPL 2.0. Coinpred ships the unmodified full source.
- Members can download the .pine file on this page to study the rules. Judge the risk yourself, and follow your venue’s rules.



