OPEN-SOURCE SCRIPT
Smart Reversal Entry

Smart Reversal Entry
Smart Reversal Entry is an open-source reversal-entry indicator built around one specific analytical idea:
after a short, directional three-candle expansion move, the first confirmed candle closing back in the opposite direction can create a structured reversal-entry opportunity when it appears in the correct EMA context.
This script is not designed to mark every bullish or bearish candle, and it is not intended to behave like a generic trend-following overlay, a standard candlestick-pattern indicator, or a broad “signal generator” that reacts to every small reversal. Its purpose is to measure short-term directional exhaustion in a standardized way, filter that move through an EMA context, require close-confirmed reversal behavior, and then project a fixed-risk trade structure directly on the chart for analysis and review.
The script also includes an internal background optimizer and review tables so users can compare how the same reversal framework behaves under different parameter combinations. These review tools are included to support study and comparison, not to imply future performance.
OPEN-SOURCE NOTE
This script is published open-source so users can inspect the logic directly, verify what the script is doing, and adapt parts of the workflow for their own research if they wish.
Even though the code is open, this description is intentionally detailed because many TradingView users do not read Pine Script. The goal is for a user to understand what the script does, how it works, why its parts belong together, and how it may be used in practice without having to study the code line by line.
OVERVIEW
At a high level, the script does six things:
1. It measures whether the last three candles produced a directional move large enough to matter in pip terms.
2. It checks whether price is positioned on the correct side of a selected EMA filter.
3. It requires the current candle to close in the opposite direction as confirmation of a possible reversal.
4. It maps a fixed stop-loss and a selectable take-profit multiple directly onto the chart.
5. It tracks projected trade outcomes and summarizes them in a review table and a daily PnL table.
6. It runs a hidden background optimizer over multiple EMA and move-threshold combinations so the user can compare the current settings to an internal parameter sweep.
The script is therefore meant to function as a complete reversal-entry and review framework rather than as a single-purpose candle-pattern marker.
CORE IDEA
Many reversal-style tools identify isolated candles or basic candlestick formations, but they do not standardize the market context around them.
This script is built around the idea that a reversal signal becomes more meaningful when three specific things happen together:
1. price has already made a clear short-term directional move,
2. that move is large enough to matter relative to the chosen pip structure,
3. and the next confirmed candle closes back in the opposite direction while price remains on the correct side of an EMA filter.
The model is intentionally narrow.
It does not try to identify every turning point in the market.
It does not try to classify broad market structure.
It does not use discretionary support and resistance interpretation.
It does not rely on vague candle descriptions such as “looks weak” or “looks exhausted”.
Instead, it defines reversal-entry conditions using a fixed sequence:
first measure a three-candle directional push,
then filter it using EMA context,
then require an opposite close-confirmed candle,
then project a standardized risk framework,
then review the resulting projected outcomes over time.
That narrower focus is the main reason this script exists in its current form.
WHY THIS SCRIPT IS NOT A SIMPLE MASHUP
This script combines multiple components, but they are not included simply to place more features into one publication.
Each component has a specific function inside the same analytical workflow:
- The EMA filter defines directional context.
- The three-candle move measurement defines whether a short-term push is large enough to qualify.
- The reversal candle confirmation defines the actual entry trigger.
- The pip-based stop-loss and RR framework standardize trade projection.
- The summary and daily review tables organize projected outcomes into a readable review structure.
- The internal optimizer compares the same reversal logic across multiple hidden EMA and move-threshold combinations.
These layers are interdependent.
Without the three-candle move measurement, the script would react to many small candles that do not represent meaningful short-term expansion.
Without the EMA filter, the script would lose its directional context and become a more generic reversal marker.
Without the close-confirmed reversal candle, the script would identify momentum but not the actual reversal-entry moment.
Without the risk projection layer, the user would still need to manually draw the entry, stop, and target after every signal.
Without the review tables, the user would have less organized feedback when reviewing results under the selected settings.
Without the internal optimizer, the user would see only the current configuration and not how the same logic behaves across a broader parameter range.
For that reason, the script is intended as a single reversal-entry framework, not as a random collection of unrelated features.
WHAT THE SCRIPT DOES
The script identifies reversal-entry setups using a strict, rule-based structure.
Long setup requirements:
- price must be above the selected EMA,
- the prior three candles must all be bearish,
- the combined bearish move across that sequence must reach the minimum pip threshold,
- the current candle must close bullish.
Short setup requirements:
- price must be below the selected EMA,
- the prior three candles must all be bullish,
- the combined bullish move across that sequence must reach the minimum pip threshold,
- the current candle must close bearish.
When a valid signal appears, the script can:
- place a BUY or SELL label,
- project a fixed stop loss in pips,
- project a take-profit level using the selected RR multiple,
- draw TP/SL boxes,
- draw an entry line,
- keep historical projected trades visible for later review,
- summarize projected outcomes in a summary table,
- summarize recent daily projected behavior in a daily PnL table.
The script also evaluates an internal optimizer in the background. That optimizer tests multiple EMA lengths and minimum-move combinations using the same reversal logic and displays the best-performing parameter combination inside the summary table over the shared analysis window.
HOW THE SCRIPT WORKS
1) EMA CONTEXT FILTER
The script uses a single EMA as a directional filter.
For long setups:
price must close above the selected EMA.
For short setups:
price must close below the selected EMA.
This does not turn the script into a pure trend-following system. Instead, it acts as a directional context filter so that reversal entries are only considered when price is positioned on the chosen side of the EMA.
In practical terms, the EMA filter is used to reduce context-free reversal signals. A bullish candle appearing after a bearish push is not enough by itself. The script still wants price to be trading above the selected EMA for longs, and below it for shorts.
2) THREE-CANDLE DIRECTIONAL MOVE MEASUREMENT
The script looks at the three candles immediately before the signal candle.
For a long setup:
those three candles must all be bearish.
For a short setup:
those three candles must all be bullish.
The script then measures the total directional move across that sequence in pip terms.
For long setups, it calculates the bearish move from the open of the first candle in the sequence to the close of the third bearish candle.
For short setups, it calculates the bullish move from the open of the first candle in the sequence to the close of the third bullish candle.
That move must be at least as large as the user-defined “Minimum 3-Candle Move (Pips)” setting.
This is one of the key parts of the script’s logic. It ensures that the setup is not based on three arbitrary candles, but on a directional push that is large enough to meet the minimum threshold selected by the user.
3) REVERSAL CANDLE CONFIRMATION
After the three-candle directional push is identified, the current candle must close in the opposite direction.
For long setups:
the current candle must close bullish.
For short setups:
the current candle must close bearish.
This requirement is intentionally strict. The script does not treat intrabar movement or unfinished candles as a valid signal. Signals are confirmed only when the bar closes.
This matters because a reversal that looks valid intrabar can disappear by the close. By waiting for close confirmation, the script reduces premature signal marking.
4) COOLDOWN FILTER
The script includes a cooldown period between signals.
Once a signal has fired, a new signal is not allowed until a defined number of bars has passed. In the current implementation, that cooldown is handled internally.
The purpose of this filter is to reduce signal clustering and prevent the chart from producing multiple nearby entries from the same short-term market behavior.
5) PIP-BASED RISK PROJECTION
When a valid signal appears, the script creates a projected trade framework using:
- entry at the signal close,
- a fixed stop-loss distance in pips,
- a take-profit level based on the selected risk/reward multiple.
This makes the projection logic standardized across signals.
For long setups:
- stop loss is placed below entry,
- take profit is placed above entry.
For short setups:
- stop loss is placed above entry,
- take profit is placed below entry.
The script can draw:
- entry line,
- TP box,
- SL box,
- BUY / SELL label,
- TP / SL hit labels.
This projection layer is not meant to claim that a setup will succeed. Its purpose is to reduce manual chart annotation and make the behavior of the signal model easier to inspect after the fact.
6) SAME-BAR TP/SL PRIORITY RULE
The script uses a strict and conservative rule when both target and stop would appear to be touched on the same bar after entry:
if TP and SL are both reached on the same bar, SL takes priority.
This is an important implementation detail because it directly affects projected statistics. It makes the review logic more conservative and avoids optimistic ambiguity when bar data alone cannot determine exact intrabar order.
7) SHARED ANALYSIS WINDOW
The script uses a shared analysis window internally.
Projected results and optimizer comparisons are evaluated over a rolling historical range rather than over the full unlimited chart history. This keeps the internal review process more controlled and makes the optimizer comparison consistent inside the same defined lookback window.
8) INTERNAL OPTIMIZER
One of the script’s more advanced components is the internal optimizer.
The optimizer runs in the background and is intentionally not exposed as a user-facing optimization panel. Instead of asking the user to manually test every variation, the script internally evaluates combinations of:
- 10 EMA values,
- 10 minimum-move thresholds.
That produces 100 total internal combinations.
Each combination uses the same reversal logic:
- EMA context,
- three-candle directional sequence,
- minimum move threshold,
- opposite close-confirmed candle,
- same stop-loss and RR structure.
The optimizer then tracks projected wins, losses, net R, gross profit, and gross loss for each combination, and the summary table displays the current best combination based on the script’s internal comparison rules.
This optimizer is not intended to present a “perfect setting”. It is a comparative review aid that helps the user understand how the same reversal framework behaves across multiple hidden parameter combinations.
WHAT MAKES THIS SCRIPT ORIGINAL
This script uses familiar technical-analysis building blocks such as:
- EMA filtering,
- candle-sequence logic,
- pip-based move measurement,
- fixed stop-loss projection,
- risk/reward mapping,
- performance review tables.
Those building blocks are not original by themselves.
The originality of this script is not in inventing a completely new primitive indicator. The originality lies in how these familiar elements are arranged into one tightly defined reversal-entry workflow:
EMA context
→ three-candle directional expansion
→ minimum pip-threshold validation
→ opposite candle close confirmation
→ fixed-risk trade projection
→ on-chart review
→ internal background parameter comparison
That full sequence is the main reason this script exists as its own publication.
It is not intended to be simply another EMA filter, another candlestick marker, another TP/SL visualizer, or another optimizer dashboard. It is specifically a short-term reversal-entry framework that combines directional context, expansion measurement, confirmation logic, risk mapping, and review in one workflow.
WHAT APPEARS ON THE CHART
Depending on settings, the chart may display:
- EMA line,
- BUY labels,
- SELL labels,
- signal-bar background highlights,
- entry line,
- TP box,
- SL box,
- TP hit labels,
- SL hit labels,
- summary table,
- daily PnL table.
Users who want a cleaner chart can disable some visual layers and keep only the ones most relevant to their workflow.
HOW TO USE THE SCRIPT
A practical workflow is:
1. Add the script to a standard candlestick chart.
2. Select the EMA length you want to use as directional context.
3. Set the minimum three-candle move threshold in pips.
4. Set the pip preset correctly for the instrument, or use manual pip size if needed.
5. Choose the stop-loss distance in pips.
6. Select the RR mode used for take-profit projection.
7. Wait for a valid long or short setup to appear.
8. Use the projected entry, stop, and target structure as a chart-analysis framework rather than as a blind instruction.
9. Review projected trade behavior in the summary table and daily table.
10. Compare your selected settings with the optimizer’s best internal combination, but do not treat the optimizer output as a guaranteed best future configuration.
This script is best understood as a structured decision-support and reversal-review tool, not as a self-sufficient trading system.
SETTINGS REFERENCE
Signal Settings
- EMA Length: sets the EMA used as the directional filter.
- Minimum 3-Candle Move (Pips): defines how large the directional three-candle move must be before a reversal candle can qualify.
Pip Settings
- Pip Preset: selects a predefined pip-size interpretation for common instrument types.
- Manual Pip Size: allows direct control when the selected symbol needs a custom pip conversion.
Risk Management
- Stop Loss (Pips): sets the fixed stop-loss distance in pip units.
- Take Profit RR: sets the projected target multiple relative to the stop-loss distance.
Visual Settings
- Show Buy/Sell Labels: shows or hides the signal labels.
- Highlight Signal Bars: adds background color to signal bars.
- Show Entry Line: shows or hides the projected entry line.
- Show TP/SL Hit Labels: controls whether projected outcomes are labeled.
- Show TP Hit Labels: controls TP hit labels specifically.
- Show SL Hit Labels: controls SL hit labels specifically.
Summary Table
- Show Summary Table: enables or disables the main review table.
- Table Position: sets the table location.
- Table Text Size: controls summary-table text size.
Daily PnL Table
- Show Daily PnL Table: enables or disables the daily review table.
- Daily Table Position: sets the daily table location.
- Daily Table Text Size: controls daily-table text size.
INTERNAL LOGIC NOTES
The current code also includes internal settings that are not exposed as user-facing optimization controls. These include:
- signal cooldown,
- shared analysis window,
- maximum stored closed-trade visuals,
- hidden optimizer activation,
- internal optimizer parameter combinations.
These internal elements exist to keep the public interface simpler while still allowing the script to maintain consistent review behavior in the background.
IMPORTANT PRACTICAL NOTE ON PIP SIZE
The script uses pip-based calculations for:
- the minimum three-candle move,
- stop-loss distance,
- take-profit distance,
- optimizer comparison logic.
Because of that, correct pip interpretation is extremely important.
If signals appear too frequent, too rare, too compressed, or visually inconsistent for the instrument being analyzed, the first setting to verify is Pip Preset or Manual Pip Size.
This matters especially for:
- gold symbols,
- 5-digit forex symbols,
- JPY forex pairs,
- indices and CFD-style instruments,
- custom broker symbols with unusual decimal formatting.
LIMITATIONS AND SHORTCOMINGS
This script has important limitations:
- It is a short-term reversal model, not a full market-structure engine.
- It only evaluates one specific reversal pattern based on a three-candle directional push and an opposite close-confirmed candle.
- It does not use support/resistance structure, volume profile, or discretionary context.
- It relies on pip conversion, so poor pip settings can distort signal behavior.
- The internal optimizer compares parameter combinations only inside the defined shared analysis window.
- The optimizer output is a comparative review tool, not a guarantee that the best historical combination will remain best in future market conditions.
- Projected results depend on the script’s own simplified outcome logic.
- If TP and SL are both touched on the same bar, SL is prioritized by design, which makes the logic more conservative but also affects outcome statistics.
- Historical projected trades and review metrics are chart-based review aids, not proof of tradable real-world execution.
- No reversal-entry model can remove all false signals or all regime-dependent behavior.
For those reasons, the script should be used as a structured analysis and review framework, not as a promise of future profitability.
WHO THIS SCRIPT MAY BE USEFUL FOR
This script may be useful for traders who:
- want a rules-based short-term reversal-entry model,
- want EMA-based directional context,
- want a minimum expansion threshold before a reversal is allowed,
- want fixed-risk trade projection on the chart,
- want review tables for projected outcomes,
- want background comparison of multiple EMA and move-threshold combinations.
It may be less suitable for traders who:
- want a broad trend-following system,
- want a discretionary support/resistance engine,
- want a multi-pattern candlestick library,
- want a fully automated strategy with no outside confirmation,
- want outcome metrics interpreted as live performance promises.
DISCLAIMER
This script is provided for educational and informational purposes only.
It does not constitute financial, investment, or trading advice.
Market conditions change, historical behavior does not guarantee future results, and users should perform their own analysis, validation, and risk management before using the script in live decision-making.
Smart Reversal Entry is an open-source reversal-entry indicator built around one specific analytical idea:
after a short, directional three-candle expansion move, the first confirmed candle closing back in the opposite direction can create a structured reversal-entry opportunity when it appears in the correct EMA context.
This script is not designed to mark every bullish or bearish candle, and it is not intended to behave like a generic trend-following overlay, a standard candlestick-pattern indicator, or a broad “signal generator” that reacts to every small reversal. Its purpose is to measure short-term directional exhaustion in a standardized way, filter that move through an EMA context, require close-confirmed reversal behavior, and then project a fixed-risk trade structure directly on the chart for analysis and review.
The script also includes an internal background optimizer and review tables so users can compare how the same reversal framework behaves under different parameter combinations. These review tools are included to support study and comparison, not to imply future performance.
OPEN-SOURCE NOTE
This script is published open-source so users can inspect the logic directly, verify what the script is doing, and adapt parts of the workflow for their own research if they wish.
Even though the code is open, this description is intentionally detailed because many TradingView users do not read Pine Script. The goal is for a user to understand what the script does, how it works, why its parts belong together, and how it may be used in practice without having to study the code line by line.
OVERVIEW
At a high level, the script does six things:
1. It measures whether the last three candles produced a directional move large enough to matter in pip terms.
2. It checks whether price is positioned on the correct side of a selected EMA filter.
3. It requires the current candle to close in the opposite direction as confirmation of a possible reversal.
4. It maps a fixed stop-loss and a selectable take-profit multiple directly onto the chart.
5. It tracks projected trade outcomes and summarizes them in a review table and a daily PnL table.
6. It runs a hidden background optimizer over multiple EMA and move-threshold combinations so the user can compare the current settings to an internal parameter sweep.
The script is therefore meant to function as a complete reversal-entry and review framework rather than as a single-purpose candle-pattern marker.
CORE IDEA
Many reversal-style tools identify isolated candles or basic candlestick formations, but they do not standardize the market context around them.
This script is built around the idea that a reversal signal becomes more meaningful when three specific things happen together:
1. price has already made a clear short-term directional move,
2. that move is large enough to matter relative to the chosen pip structure,
3. and the next confirmed candle closes back in the opposite direction while price remains on the correct side of an EMA filter.
The model is intentionally narrow.
It does not try to identify every turning point in the market.
It does not try to classify broad market structure.
It does not use discretionary support and resistance interpretation.
It does not rely on vague candle descriptions such as “looks weak” or “looks exhausted”.
Instead, it defines reversal-entry conditions using a fixed sequence:
first measure a three-candle directional push,
then filter it using EMA context,
then require an opposite close-confirmed candle,
then project a standardized risk framework,
then review the resulting projected outcomes over time.
That narrower focus is the main reason this script exists in its current form.
WHY THIS SCRIPT IS NOT A SIMPLE MASHUP
This script combines multiple components, but they are not included simply to place more features into one publication.
Each component has a specific function inside the same analytical workflow:
- The EMA filter defines directional context.
- The three-candle move measurement defines whether a short-term push is large enough to qualify.
- The reversal candle confirmation defines the actual entry trigger.
- The pip-based stop-loss and RR framework standardize trade projection.
- The summary and daily review tables organize projected outcomes into a readable review structure.
- The internal optimizer compares the same reversal logic across multiple hidden EMA and move-threshold combinations.
These layers are interdependent.
Without the three-candle move measurement, the script would react to many small candles that do not represent meaningful short-term expansion.
Without the EMA filter, the script would lose its directional context and become a more generic reversal marker.
Without the close-confirmed reversal candle, the script would identify momentum but not the actual reversal-entry moment.
Without the risk projection layer, the user would still need to manually draw the entry, stop, and target after every signal.
Without the review tables, the user would have less organized feedback when reviewing results under the selected settings.
Without the internal optimizer, the user would see only the current configuration and not how the same logic behaves across a broader parameter range.
For that reason, the script is intended as a single reversal-entry framework, not as a random collection of unrelated features.
WHAT THE SCRIPT DOES
The script identifies reversal-entry setups using a strict, rule-based structure.
Long setup requirements:
- price must be above the selected EMA,
- the prior three candles must all be bearish,
- the combined bearish move across that sequence must reach the minimum pip threshold,
- the current candle must close bullish.
Short setup requirements:
- price must be below the selected EMA,
- the prior three candles must all be bullish,
- the combined bullish move across that sequence must reach the minimum pip threshold,
- the current candle must close bearish.
When a valid signal appears, the script can:
- place a BUY or SELL label,
- project a fixed stop loss in pips,
- project a take-profit level using the selected RR multiple,
- draw TP/SL boxes,
- draw an entry line,
- keep historical projected trades visible for later review,
- summarize projected outcomes in a summary table,
- summarize recent daily projected behavior in a daily PnL table.
The script also evaluates an internal optimizer in the background. That optimizer tests multiple EMA lengths and minimum-move combinations using the same reversal logic and displays the best-performing parameter combination inside the summary table over the shared analysis window.
HOW THE SCRIPT WORKS
1) EMA CONTEXT FILTER
The script uses a single EMA as a directional filter.
For long setups:
price must close above the selected EMA.
For short setups:
price must close below the selected EMA.
This does not turn the script into a pure trend-following system. Instead, it acts as a directional context filter so that reversal entries are only considered when price is positioned on the chosen side of the EMA.
In practical terms, the EMA filter is used to reduce context-free reversal signals. A bullish candle appearing after a bearish push is not enough by itself. The script still wants price to be trading above the selected EMA for longs, and below it for shorts.
2) THREE-CANDLE DIRECTIONAL MOVE MEASUREMENT
The script looks at the three candles immediately before the signal candle.
For a long setup:
those three candles must all be bearish.
For a short setup:
those three candles must all be bullish.
The script then measures the total directional move across that sequence in pip terms.
For long setups, it calculates the bearish move from the open of the first candle in the sequence to the close of the third bearish candle.
For short setups, it calculates the bullish move from the open of the first candle in the sequence to the close of the third bullish candle.
That move must be at least as large as the user-defined “Minimum 3-Candle Move (Pips)” setting.
This is one of the key parts of the script’s logic. It ensures that the setup is not based on three arbitrary candles, but on a directional push that is large enough to meet the minimum threshold selected by the user.
3) REVERSAL CANDLE CONFIRMATION
After the three-candle directional push is identified, the current candle must close in the opposite direction.
For long setups:
the current candle must close bullish.
For short setups:
the current candle must close bearish.
This requirement is intentionally strict. The script does not treat intrabar movement or unfinished candles as a valid signal. Signals are confirmed only when the bar closes.
This matters because a reversal that looks valid intrabar can disappear by the close. By waiting for close confirmation, the script reduces premature signal marking.
4) COOLDOWN FILTER
The script includes a cooldown period between signals.
Once a signal has fired, a new signal is not allowed until a defined number of bars has passed. In the current implementation, that cooldown is handled internally.
The purpose of this filter is to reduce signal clustering and prevent the chart from producing multiple nearby entries from the same short-term market behavior.
5) PIP-BASED RISK PROJECTION
When a valid signal appears, the script creates a projected trade framework using:
- entry at the signal close,
- a fixed stop-loss distance in pips,
- a take-profit level based on the selected risk/reward multiple.
This makes the projection logic standardized across signals.
For long setups:
- stop loss is placed below entry,
- take profit is placed above entry.
For short setups:
- stop loss is placed above entry,
- take profit is placed below entry.
The script can draw:
- entry line,
- TP box,
- SL box,
- BUY / SELL label,
- TP / SL hit labels.
This projection layer is not meant to claim that a setup will succeed. Its purpose is to reduce manual chart annotation and make the behavior of the signal model easier to inspect after the fact.
6) SAME-BAR TP/SL PRIORITY RULE
The script uses a strict and conservative rule when both target and stop would appear to be touched on the same bar after entry:
if TP and SL are both reached on the same bar, SL takes priority.
This is an important implementation detail because it directly affects projected statistics. It makes the review logic more conservative and avoids optimistic ambiguity when bar data alone cannot determine exact intrabar order.
7) SHARED ANALYSIS WINDOW
The script uses a shared analysis window internally.
Projected results and optimizer comparisons are evaluated over a rolling historical range rather than over the full unlimited chart history. This keeps the internal review process more controlled and makes the optimizer comparison consistent inside the same defined lookback window.
8) INTERNAL OPTIMIZER
One of the script’s more advanced components is the internal optimizer.
The optimizer runs in the background and is intentionally not exposed as a user-facing optimization panel. Instead of asking the user to manually test every variation, the script internally evaluates combinations of:
- 10 EMA values,
- 10 minimum-move thresholds.
That produces 100 total internal combinations.
Each combination uses the same reversal logic:
- EMA context,
- three-candle directional sequence,
- minimum move threshold,
- opposite close-confirmed candle,
- same stop-loss and RR structure.
The optimizer then tracks projected wins, losses, net R, gross profit, and gross loss for each combination, and the summary table displays the current best combination based on the script’s internal comparison rules.
This optimizer is not intended to present a “perfect setting”. It is a comparative review aid that helps the user understand how the same reversal framework behaves across multiple hidden parameter combinations.
WHAT MAKES THIS SCRIPT ORIGINAL
This script uses familiar technical-analysis building blocks such as:
- EMA filtering,
- candle-sequence logic,
- pip-based move measurement,
- fixed stop-loss projection,
- risk/reward mapping,
- performance review tables.
Those building blocks are not original by themselves.
The originality of this script is not in inventing a completely new primitive indicator. The originality lies in how these familiar elements are arranged into one tightly defined reversal-entry workflow:
EMA context
→ three-candle directional expansion
→ minimum pip-threshold validation
→ opposite candle close confirmation
→ fixed-risk trade projection
→ on-chart review
→ internal background parameter comparison
That full sequence is the main reason this script exists as its own publication.
It is not intended to be simply another EMA filter, another candlestick marker, another TP/SL visualizer, or another optimizer dashboard. It is specifically a short-term reversal-entry framework that combines directional context, expansion measurement, confirmation logic, risk mapping, and review in one workflow.
WHAT APPEARS ON THE CHART
Depending on settings, the chart may display:
- EMA line,
- BUY labels,
- SELL labels,
- signal-bar background highlights,
- entry line,
- TP box,
- SL box,
- TP hit labels,
- SL hit labels,
- summary table,
- daily PnL table.
Users who want a cleaner chart can disable some visual layers and keep only the ones most relevant to their workflow.
HOW TO USE THE SCRIPT
A practical workflow is:
1. Add the script to a standard candlestick chart.
2. Select the EMA length you want to use as directional context.
3. Set the minimum three-candle move threshold in pips.
4. Set the pip preset correctly for the instrument, or use manual pip size if needed.
5. Choose the stop-loss distance in pips.
6. Select the RR mode used for take-profit projection.
7. Wait for a valid long or short setup to appear.
8. Use the projected entry, stop, and target structure as a chart-analysis framework rather than as a blind instruction.
9. Review projected trade behavior in the summary table and daily table.
10. Compare your selected settings with the optimizer’s best internal combination, but do not treat the optimizer output as a guaranteed best future configuration.
This script is best understood as a structured decision-support and reversal-review tool, not as a self-sufficient trading system.
SETTINGS REFERENCE
Signal Settings
- EMA Length: sets the EMA used as the directional filter.
- Minimum 3-Candle Move (Pips): defines how large the directional three-candle move must be before a reversal candle can qualify.
Pip Settings
- Pip Preset: selects a predefined pip-size interpretation for common instrument types.
- Manual Pip Size: allows direct control when the selected symbol needs a custom pip conversion.
Risk Management
- Stop Loss (Pips): sets the fixed stop-loss distance in pip units.
- Take Profit RR: sets the projected target multiple relative to the stop-loss distance.
Visual Settings
- Show Buy/Sell Labels: shows or hides the signal labels.
- Highlight Signal Bars: adds background color to signal bars.
- Show Entry Line: shows or hides the projected entry line.
- Show TP/SL Hit Labels: controls whether projected outcomes are labeled.
- Show TP Hit Labels: controls TP hit labels specifically.
- Show SL Hit Labels: controls SL hit labels specifically.
Summary Table
- Show Summary Table: enables or disables the main review table.
- Table Position: sets the table location.
- Table Text Size: controls summary-table text size.
Daily PnL Table
- Show Daily PnL Table: enables or disables the daily review table.
- Daily Table Position: sets the daily table location.
- Daily Table Text Size: controls daily-table text size.
INTERNAL LOGIC NOTES
The current code also includes internal settings that are not exposed as user-facing optimization controls. These include:
- signal cooldown,
- shared analysis window,
- maximum stored closed-trade visuals,
- hidden optimizer activation,
- internal optimizer parameter combinations.
These internal elements exist to keep the public interface simpler while still allowing the script to maintain consistent review behavior in the background.
IMPORTANT PRACTICAL NOTE ON PIP SIZE
The script uses pip-based calculations for:
- the minimum three-candle move,
- stop-loss distance,
- take-profit distance,
- optimizer comparison logic.
Because of that, correct pip interpretation is extremely important.
If signals appear too frequent, too rare, too compressed, or visually inconsistent for the instrument being analyzed, the first setting to verify is Pip Preset or Manual Pip Size.
This matters especially for:
- gold symbols,
- 5-digit forex symbols,
- JPY forex pairs,
- indices and CFD-style instruments,
- custom broker symbols with unusual decimal formatting.
LIMITATIONS AND SHORTCOMINGS
This script has important limitations:
- It is a short-term reversal model, not a full market-structure engine.
- It only evaluates one specific reversal pattern based on a three-candle directional push and an opposite close-confirmed candle.
- It does not use support/resistance structure, volume profile, or discretionary context.
- It relies on pip conversion, so poor pip settings can distort signal behavior.
- The internal optimizer compares parameter combinations only inside the defined shared analysis window.
- The optimizer output is a comparative review tool, not a guarantee that the best historical combination will remain best in future market conditions.
- Projected results depend on the script’s own simplified outcome logic.
- If TP and SL are both touched on the same bar, SL is prioritized by design, which makes the logic more conservative but also affects outcome statistics.
- Historical projected trades and review metrics are chart-based review aids, not proof of tradable real-world execution.
- No reversal-entry model can remove all false signals or all regime-dependent behavior.
For those reasons, the script should be used as a structured analysis and review framework, not as a promise of future profitability.
WHO THIS SCRIPT MAY BE USEFUL FOR
This script may be useful for traders who:
- want a rules-based short-term reversal-entry model,
- want EMA-based directional context,
- want a minimum expansion threshold before a reversal is allowed,
- want fixed-risk trade projection on the chart,
- want review tables for projected outcomes,
- want background comparison of multiple EMA and move-threshold combinations.
It may be less suitable for traders who:
- want a broad trend-following system,
- want a discretionary support/resistance engine,
- want a multi-pattern candlestick library,
- want a fully automated strategy with no outside confirmation,
- want outcome metrics interpreted as live performance promises.
DISCLAIMER
This script is provided for educational and informational purposes only.
It does not constitute financial, investment, or trading advice.
Market conditions change, historical behavior does not guarantee future results, and users should perform their own analysis, validation, and risk management before using the script in live decision-making.
Скрипт с открытым кодом
В истинном духе TradingView, создатель этого скрипта сделал его открытым исходным кодом, чтобы трейдеры могли проверить и убедиться в его функциональности. Браво автору! Вы можете использовать его бесплатно, но помните, что перепубликация кода подчиняется нашим Правилам поведения.
Trader. Analyst.💻 Clean indicators & Systems 📈
whop.com/joined/tradewsamet/ discord.com/invite/WeunuuvjBG
whop.com/joined/tradewsamet/ discord.com/invite/WeunuuvjBG
Отказ от ответственности
Информация и публикации не предназначены для предоставления и не являются финансовыми, инвестиционными, торговыми или другими видами советов или рекомендаций, предоставленных или одобренных TradingView. Подробнее читайте в Условиях использования.
Скрипт с открытым кодом
В истинном духе TradingView, создатель этого скрипта сделал его открытым исходным кодом, чтобы трейдеры могли проверить и убедиться в его функциональности. Браво автору! Вы можете использовать его бесплатно, но помните, что перепубликация кода подчиняется нашим Правилам поведения.
Trader. Analyst.💻 Clean indicators & Systems 📈
whop.com/joined/tradewsamet/ discord.com/invite/WeunuuvjBG
whop.com/joined/tradewsamet/ discord.com/invite/WeunuuvjBG
Отказ от ответственности
Информация и публикации не предназначены для предоставления и не являются финансовыми, инвестиционными, торговыми или другими видами советов или рекомендаций, предоставленных или одобренных TradingView. Подробнее читайте в Условиях использования.