No algorithmic trading strategy is the most successful in general. Trend following, mean reversion, breakout, carry and event-driven rules each bet on a different market behaviour. Whether one makes or loses money depends on the market, the regime of the period, trading costs and how the orders are executed. The answer worth having is which family fits a market you can test, and what would break it.

PineConnector's strategy library starts here: each family as a rule you could write, what tends to break it, and the page that covers it. PineConnector passes the instructions in your TradingView alerts to a MetaTrader EA. It does not choose strategies, and automating a rule does not give the rule an edge.
Algorithmic trading strategies at a glance
An algorithmic trading strategy is a set of rules precise enough for software to evaluate: when to enter, when to exit and how much to trade, each stated as a measurable condition. The guide to turning a setup into measurable conditions covers that step. The families differ mainly in the market behaviour each rule expects.
Scroll horizontally to read every column.
| Strategy family | How it reads as a rule | What tends to break it |
|---|---|---|
| Trend following and momentum | Hold in the direction of a measured move, for example while the close stays above an N-bar moving average. | Sideways ranges that reverse each signal soon after entry. |
| Breakout | Enter when price leaves a defined range, such as the prior N bars' highest high or a session's opening range. | False breakouts, and fills beyond the level. |
| Mean reversion | Fade a stretch from a reference level, such as a close below a lower Bollinger Band, and exit near the mean. | A stretch that keeps extending into a trend. |
| Carry | Hold the side whose overnight financing is favourable, with a separate exit for price risk. | Price moves that outweigh the financing, and swap changes. |
| Event-driven | Act, or stand aside, in a stated window around a dated event such as a scheduled release. | Reactions unlike the few events tested, and broker quotes unlike chart quotes. |
| Price action and support and resistance | Act at a level computed by rule: a prior day's high, a confirmed swing high or a round number. | Levels drawn by hand, or detected with hindsight. |
| Smart money concepts | Write terms such as fair value gap or break of structure as exact comparisons of bar highs and lows. | Terms that need judgement, or swing points that confirm later. |
| Relative value and pairs | Trade the spread between two related instruments when it widens; close both legs when it narrows. | A relationship that breaks, and legs that fill separately. |
Holding period is not a separate family: scalping, day, swing and position trading are horizons that apply to every row, compared in the scalping vs swing trading guide. For the smallest complete rule sets, start with the simplest trading strategies to automate.
Why is no strategy the most successful?
A strategy's result comes from its rule and the conditions the rule met. Change the conditions and the ranking of strategy types changes. Four conditions matter most.
- Market and regime. Koijen, Moskowitz, Pedersen and Vrugt found times when carry strategies did poorly across all asset classes at once, and those episodes coincided with global recessions.[1] A ranking taken from one period may not hold in the next.
- Costs. Spread, commission, slippage and swap apply to every trade, so one rule can survive a long holding period and fail a short one. A Pine strategy applies no commission unless its settings specify one.[2]
- Execution. TradingView's broker emulator fills a strategy's orders from chart data, unlike a real broker.[2] TradingView and MetaTrader can also use different data feeds, quotes, spreads and timestamps.[3] MetaQuotes describes the MT5 tester's No Delay mode as "ideal" conditions.[4]
- Search. Testing many rules and keeping the best finds luck as well as skill. Harvey, Liu and Zhu argue that, given extensive data mining, "most claimed research findings in financial economics are likely false".[5] TradingView warns that an overfit strategy "often fails to perform well on new, unseen data".[2]
Marketing that names one best algorithm deserves the same scepticism. The US Commodity Futures Trading Commission (CFTC) warns that fraudsters exploit interest in AI to promote trading algorithms promising unreasonably high returns, and states that AI "can’t predict the future or sudden market changes".[6]
Worked example: one cost, two holding periods
Illustrative, not a recommendation. Take one rule whose target is twice its stop: a win is 2R and a loss is 1R, where R is the initial risk. Assume a round-trip cost of 1 pip for spread and commission, ignore swap, and compare a 10-pip stop with a 50-pip stop.
Break-even win rate = (1 + c) / (T + 1), where T is the target in R and c is the cost per trade in R
The formula sets expectancy, (win rate × average win) − (loss rate × average loss), to zero after subtracting the cost from each trade. With no cost it reduces to 1 / (1 + T), the before-costs break-even rule in PineConnector's Analytics guide.[7]
| Illustrative values | 10-pip stop, 20-pip target | 50-pip stop, 100-pip target |
|---|---|---|
| Cost in R (1 pip ÷ stop) | 0.1R | 0.02R |
| Break-even win rate before costs | 1 / 3 = 33.3% | 1 / 3 = 33.3% |
| Break-even win rate with the cost | 1.1 / 3 = 36.7% | 1.02 / 3 = 34.0% |
The same 1-pip cost raises the required win rate by 3.3 percentage points on the short trade and by 0.7 points on the long one. Neither version is shown to be profitable; the example shows only how a small cost can decide a short-horizon rule. The break-even win rate guide covers the formula in full.
How does each strategy family read as rules?
Each family below is described by the behaviour it expects, one rule that expresses it and what breaks it. Lookbacks, thresholds and levels are yours to choose and test. None of the values here is a recommendation.

Trend following and momentum
Trend following holds positions in the direction of an established move. Moskowitz, Ooi and Pedersen describe time-series momentum as focusing "purely on a security’s own past return", unlike cross-sectional momentum, which compares securities with each other.[8] A rule might stay long while the close is above its N-bar moving average. Donchian Channels, created by Richard Donchian, give a breakout version: the highest high and lowest low of the last N bars.[9] As indicators, J. Welles Wilder's RSI (1978) and Gerald Appel's MACD (1970s) both measure momentum.[10][11] The trend-following rules guide has complete specifications.
Mean reversion
Mean reversion expects a stretched price to move back toward a reference level. Bollinger Bands, created by John Bollinger in the early 1980s, usually centre on a 20-day simple moving average with bands typically two standard deviations away.[12] A rule might buy a close below the lower band and exit at the middle band. Wilder treated an RSI above 70 as overbought and below 30 as oversold.[10]
One RSI reading can therefore support opposite rules: continuation for a momentum rule, a fade for a mean-reversion rule. The hypothesis defines the strategy, not the indicator. Because a stretch can keep extending, the stop is the hardest part to define. See the mean reversion rules guide and the RSI rules page.
Breakout
A breakout rule enters when price leaves a defined range, such as the highest high of the prior N bars or a session's opening range. The range must use closed bars, and the trigger must say whether an intrabar touch counts or only a close beyond the level. When price gaps past a pending order's level, TradingView's emulator fills it at the next bar's open rather than at the level.[2] Session ranges depend on the clock, so read broker server time versus UTC and TradingView time with the breakout rules guide.
Carry
Carry is the part of a return that comes from holding a position if prices stay the same. Koijen and co-authors split an asset's expected return into "carry" and expected price appreciation, noting that carry "can be measured in advance".[1] The CFTC's glossary defines a carry trade as borrowing an instrument with a low cost of carry and lending a similar one with a high cost of carry.[13]
In MT5, the overnight financing on a position is the broker's swap. The symbol specification lists swap long and swap short with a multiplier for each weekday, and MetaQuotes' example triples the Wednesday-to-Thursday charge.[14] Those values are not on a TradingView chart, so a carry rule written in Pine needs them supplied and checked separately. Read swap, rollover and overnight fees before testing one.
Event-driven
Event-driven rules act, or deliberately stand aside, around a dated event such as a scheduled economic release. A measurable version names the event list, the calendar it comes from and the time window, all of which usually sit outside the chart. TradingView's news alerts notify you when new stories match a saved news flow.[15] No message field or webhook is documented for them, as the guide to TradingView's newer alert types explains.
PineConnector documents no event-based filter. Its spread= parameter sets a maximum spread at arrival, and an entry above that limit fails the filter.[16] For standing aside, see when to pause automated trading.
Price action, support and resistance
Price-action rules act at levels: a prior day's high or low, a swing high confirmed by pivot logic, or a round number. The rule states how each level is computed and when it becomes known. A prior day's high is final at that day's close. A pivot exists only after a set number of later bars, and scripts that plot it back on the pivot bar show it earlier than it was known.[17] Levels drawn by hand are not in a strategy's code, so they cannot be backtested as they looked at the time. See the support and resistance rules guide and the ta.pivothigh repainting page.
Smart money concepts
Smart money concepts (SMC, often associated with ICT) use terms such as order block, fair value gap, break of structure and liquidity sweep. Some of them can be written as exact comparisons of bar highs and lows. Others depend on judgement, or on swing points that confirm several bars later. The smart money concepts as rules guide separates the two and makes no claim about institutional behaviour.
Relative value and pairs
Relative-value rules trade the gap between related instruments rather than the direction of one. In Gatev, Goetzmann and Rouwenhorst's pairs study, stocks "are matched into pairs according to minimum distance in historical normalized price space".[18] A rule sells the relatively expensive leg and buys the cheap one when the spread widens, then closes both when it narrows. The CFTC defines arbitrage as a simultaneous purchase and sale of identical or equivalent instruments.[13] A pair uses related, not identical, instruments, so the relationship itself can break.
Pine strategies "run on only the chart asset and cannot open positions in different assets", although request.security() can read another symbol's data.[19][20] A PineConnector message carries one symbol, so two legs mean two messages.[21] Whether both legs fill together is not documented; test on demo.
Does the holding period change the strategy?
Holding period applies to every family. The CFTC's glossary describes a scalper as holding positions "for only a short time during a trading session", a day trader as offsetting positions within the same session, and a position trader as holding for an extended period.[13] Swing trading sits between day and position trading, with positions held across several sessions.
Shorter holds make costs a larger share of each trade, as the worked example shows. Longer holds add swap and exposure to weekend gaps at the market open. Alert frequency is a practical limit too: TradingView stops an alert that triggers more than 15 times over 3 minutes.[22] The scalping vs swing trading comparison sets out what each horizon needs.
Which strategies fit a TradingView alert to MT5 order path?
A TradingView-to-MT5 strategy passes through five stages: the idea, the measurable rule, the TradingView alert, PineConnector and its EA, and the broker. Pine scripts cannot place orders themselves; external tools act on their alerts through webhooks.[19] Alerts trigger only on realtime bars, and by default a strategy calculates once per closed bar.[23][2]

- Straightforward fits are rules evaluated on a bar close or a defined price event and sent as one message per action, as most trend, breakout, mean-reversion and price-action rules can be.
- Awkward fits need data the chart does not hold: the broker's swap values for carry, a calendar for events, and two separately filled messages for pairs.
- Poor fits depend on being first to a price. The CFTC's glossary describes co-location, placing servers close to a venue's matching engine, as a way to facilitate high-frequency trading.[13] An alert-and-webhook path offers nothing comparable.
Stops need the same care. PineConnector's Pine Script converter guide states that the integration does not place a script's simulated stops and targets as protective broker orders.[24] A broker-side stop has to be requested separately, for example with sl_pips= in the message or through the EA's documented stop-loss source settings.[28]
Running two families on one account needs labels. PineConnector's multi-strategy guide documents comment= on entries, and a matching comment on closelong or closeshort targets only that strategy's positions for the symbol.[25] Illustrative messages for the TradingView alert's Message field, not a recommended size or stop; verify any message on a demo account before live use:
LicenseID,buy,EURUSD,vol_lots=0.01,sl_pips=20,comment=TREND-A
LicenseID,closelong,EURUSD,comment=TREND-A
The first requests a 0.01-lot EURUSD buy with a 20-pip stop, labelled TREND-A. The second requests closing only EURUSD buys with that exact comment; without the comment it could close the other family's buys too.[25] Use your own License ID and your broker's exact symbol.[21] How Pyramiding and Close on Reverse treat positions with different comments is not documented; test on demo.
How to use this strategy library
- Write the idea as conditions. Start with measurable conditions, then a complete rule specification covering entries, exits, size and exceptions.
- Open the family page that matches the behaviour you expect, from the table above. Each covers its rules, its failure cases and how it maps to alert conditions.
- Test before trusting. The backtesting guide covers costs and out-of-sample checks, the overfitting guide covers the search problem, and the trading performance metrics hub explains the report's numbers.
- Verify the path on demo. A working webhook does not prove that a strategy's conditions or sizing are correct.[26] A successful demo order verifies the tested setup, not that the strategy will be profitable.[27] Follow the backtest-to-demo-trade procedure.
What goes wrong when comparing strategy types?
- Ranking by backtest result. A list of the best strategies is a list of the best past fits. TradingView advises testing on multiple, ideally diverse datasets without cherry-picking ranges.[2] MetaQuotes offers MT5's forward period to avoid fitting parameters to particular stretches of history.[4]
- Comparing before costs. Families with different trade counts and holding periods pay different costs, so a comparison without costs ranks rules that cannot be traded as tested.
- Confusing an indicator with a strategy. RSI or MACD measures something; the rule decides what a reading means.
- Treating hindsight as data. Pivots and hand-drawn levels can appear on a chart earlier than they were known.[17]
- Expecting automation to add an edge. Automation executes a rule as written, and repeats a flawed rule as faithfully as a sound one.
Frequently asked questions
What is the best algo trading strategy?
No algo trading strategy is best in general. Trend following, mean reversion, breakout, carry and event-driven rules each depend on the market, the period's regime, trading costs and execution quality. A useful comparison tests each candidate on the market you trade, after costs, on data it was not tuned on, and then verifies the execution path on a demo account.
What are the main types of algorithmic trading strategies?
The main types of algorithmic trading strategies are trend following and momentum, breakout, mean reversion, carry, event-driven, price action or market structure, and relative value such as pairs trading. The types differ in the market behaviour they expect: continuation, reversal, financing, reaction to events or behaviour at levels. Holding period, from scalping to position trading, applies across all of them.
Are trend following and mean reversion opposites?
Trend following and mean reversion expect opposite behaviour. Trend following bets that a price move continues, and mean reversion bets that a stretched price returns toward a reference level. Both can use the same indicator, such as RSI, and read it in opposite ways. Each tends to struggle where the other fits: trend rules in ranges, and mean-reversion rules in persistent trends.
Can TradingView alerts run any algorithmic trading strategy?
TradingView alerts suit rules that can be evaluated on bar closes or defined price events and sent as one message per action. Pine scripts cannot place orders themselves, so an external tool must act on each alert. Strategies that depend on co-location, on filling two instruments together or on broker data such as swap rates fit an alert path poorly.
Does automating a strategy make it more successful?
Automating a strategy does not make it more successful. Automation sends the rule's orders as written, on losing signals as well as winning ones, and cannot create an edge the rule lacks. Test the rule after costs and on data it was not tuned on, then confirm on a demo account that each alert produces the intended broker order.
Reviewed 25 September 2026. Facts were checked against the linked sources on that date. Nothing in this article was tested on a trading account and no code was compiled.
Related reading
- How to backtest a trading strategy
- Trading performance metrics: the reference hub
- Technical indicators written as measurable rules
- Risk management techniques for automated trading
- How to write a trading plan you can follow
Sources
- NBER – Carry (Koijen, Moskowitz, Pedersen and Vrugt), Working Paper 19325, accessed 25 September 2026.
- TradingView – Pine Script User Manual: Strategies, accessed 25 September 2026.
- PineConnector – Frequently asked questions: price differences, accessed 25 September 2026.
- MetaQuotes – MetaTrader 5 Help: Strategy Testing, accessed 25 September 2026.
- NBER – ...and the Cross-Section of Expected Returns (Harvey, Liu and Zhu), Working Paper 20592, accessed 25 September 2026.
- CFTC – Customer Advisory: AI Won't Turn Trading Bots into Money Machines, accessed 25 September 2026.
- PineConnector – Analytics: win rate, reward-to-risk and expectancy, accessed 25 September 2026.
- AQR – Time Series Momentum (Moskowitz, Ooi and Pedersen, Journal of Financial Economics, 2012), accessed 25 September 2026.
- TradingView Help Center – Donchian Channels (DC), accessed 25 September 2026.
- TradingView Help Center – Relative Strength Index (RSI), accessed 25 September 2026.
- TradingView Help Center – Moving average convergence divergence (MACD) indicator, accessed 25 September 2026.
- TradingView Help Center – Bollinger Bands (BB), accessed 25 September 2026.
- CFTC – Futures Glossary, accessed 25 September 2026.
- MetaQuotes – MetaTrader 5 Help: Market Watch, symbol specification, accessed 25 September 2026.
- TradingView Help Center – News alerts, accessed 25 September 2026.
- PineConnector – Syntax: spread=, accessed 25 September 2026.
- TradingView – Pine Script User Manual: Repainting, accessed 25 September 2026.
- NBER – Pairs Trading: Performance of a Relative Value Arbitrage Rule (Gatev, Goetzmann and Rouwenhorst), Working Paper 7032, accessed 25 September 2026.
- TradingView – Pine Script FAQ: Strategies, accessed 25 September 2026.
- TradingView – Pine Script User Manual: Other timeframes and data, accessed 25 September 2026.
- PineConnector – Syntax: message structure, accessed 25 September 2026.
- TradingView Help Center – Alert was triggered too often and stopped, accessed 25 September 2026.
- TradingView – Pine Script User Manual: Alerts, accessed 25 September 2026.
- PineConnector – Pine Script converter: supported behaviour, accessed 25 September 2026.
- PineConnector – Keep strategies separate: closing with comments, accessed 25 September 2026.
- PineConnector – Recommendations: before the first trade, accessed 25 September 2026.
- PineConnector – Demo testing: test an active setup on a broker demo account, accessed 25 September 2026.
- PineConnector – EA settings: Setting source for stop loss, take profit and risk, accessed 25 September 2026.
PineConnector executes the instructions you send it. It does not select trades, manage money, or hold funds. Trading carries risk, and past performance of any strategy does not indicate future results.
1 comment