OPEN-SOURCE SCRIPT

The Pattern-Synced Moving Average System (PSMA)

Zaktualizowano
Description:
The Pattern-Synced Moving Average System (PSMA) is a comprehensive trading indicator that combines the reliability of moving averages with automated candlestick pattern detection, real-time alerts, and dynamic risk management to enhance both trend-following and reversal strategies. The PSMA system integrates key elements of trend analysis and pattern recognition to provide users with configurable entry, stop-loss, and take-profit levels. It is designed for all levels of traders who seek to trade in alignment with market context, using signals from trend direction and established candlestick patterns.

Key Functional Components:

Multi-Type Moving Average:

Provides flexibility with multiple moving average options: SMA, EMA, WMA, and SMMA.
The selected moving average helps users determine market trend direction, with price positions relative to the MA acting as a trend confirmation.
Automatic Candlestick Pattern Detection:

Identifies pivotal patterns, including bullish/bearish engulfing and reversal signals.
Helps traders spot potential market turning points and adjust their strategies accordingly.
Configurable Entry, Stop-Loss, and Take-Profit:

Risk management is customizable through risk/reward ratios and risk tolerance settings.
Entry, stop-loss, and take-profit levels are automatically plotted when patterns appear, facilitating rapid trade decision-making with predefined exit points.
Higher Timeframe Trend Confirmation:

Optional feature to verify trend alignment on a higher timeframe (e.g., checking a daily trend on an intraday chart).
This added filter improves signal reliability by focusing on patterns aligned with the broader market trend.
Real-Time Alerts:

Alerts can be set for key pattern detections, allowing traders to respond promptly without constant chart monitoring.
How to Use PSMA:

Set Moving Average Preferences:

Choose the preferred moving average type and length based on your trading strategy. The MA acts as a foundational trend indicator, with price positions indicating potential uptrends (price above MA) or downtrends (price below MA).
Adjust Risk Management Settings:

Set a Risk/Reward Ratio for defining take-profit levels relative to the entry and stop-loss levels.
Modify the Risk Tolerance Percentage to adjust stop-loss placement, adding flexibility in managing trades based on market volatility.
Activate Higher Timeframe Confirmation (Optional):

Enable higher timeframe trend confirmation to filter out counter-trend trades, ensuring that detected patterns are in sync with the larger market trend.
Review Alerts and Trade Levels:

With PSMA’s real-time alerts, traders receive notifications for detected patterns without having to continuously monitor charts.
Visualized entry, stop-loss, and take-profit lines simplify trade execution by highlighting levels directly on the chart.
Execute Based on Entry and Exit Levels:

The entry line suggests the potential entry price once a bullish or bearish pattern is detected.
The stop-loss line is based on your set risk tolerance, establishing a predefined risk level.
The take-profit line is calculated according to your preferred risk/reward ratio, providing a clear profit target.
Example Strategy:

Ensure price is above or below the selected moving average to confirm trend direction.
Await a PSMA signal for a bullish or bearish pattern.
Review the plotted entry, stop-loss, and take-profit lines, and enter the trade if the setup aligns with your risk/reward criteria.
Activate alerts for continuous monitoring, allowing PSMA to notify you of emerging trade opportunities.
Release Notes:

Line Color and Style Customization: Customizable colors and line styles for entry, stop-loss, and take-profit levels.
Dynamic Trade Tracking: Tracks trade statistics, including total trades, win rate, and average P/L, displayed in the data window for comprehensive trade performance analysis.
Summary: The PSMA indicator is a powerful, user-friendly tool that combines trend detection, pattern recognition, and risk management into a cohesive system for improved trade decision-making. Suitable for stocks, forex, and futures, PSMA offers a unique blend of adaptability and precision, making it valuable for day traders and long-term investors alike. Enjoy this tool as it enhances your ability to execute timely, well-informed trades on TradingView.
Informacje o Wersji
Key Additions and Adjustments
Moving Average Type Selection:

Re-added the maType input to let users select the type of moving average (SMA, EMA, SMMA, WMA, or VWMA).
The ma function computes the moving average based on the selected type, and selectedMA plots it on the chart.
ATR-Based and Percentage-Based Stop-Loss:

Maintained useATR as a toggle to switch between ATR-based and pattern range percentage-based stop-loss calculations.
Pattern Detection and Trade Levels:

Keeps scanning the chart for bullish and bearish engulfing and reversal patterns, plotting the entry, stop-loss, and take-profit levels when patterns are found.
Informacje o Wersji
Enhanced Pattern Finder - Explanation of Changes

This script has been significantly enhanced to improve its accuracy, functionality, and reliability in detecting patterns and managing trades. Below is an overview of the updates:
1. Improved Pattern Detection:
• Engulfing Patterns: Stricter criteria have been added to detect bullish and bearish engulfing patterns. The engulfing candle must:
• Have a body size 1.5x larger than the previous candle.
• Be accompanied by higher volume compared to the previous candle.
• These changes improve reliability by filtering out weaker signals.
• Reversal Patterns: Now include confirmation using a moving average. Bullish reversals require the close to be above the selected moving average, while bearish reversals require it to be below. This ensures alignment with the trend, reducing false signals.
2. New Multi-Candle Pattern - Morning Star:
• The Morning Star pattern, a powerful three-candle reversal signal, has been added:
• First candle: Strong bearish.
• Second candle: Small body indicating indecision (e.g., a doji).
• Third candle: Strong bullish close above the midpoint of the first candle.
• This addition expands the script’s versatility by detecting more complex patterns.
3. Higher Timeframe Confluence:
• Patterns are now validated against higher timeframe trends to improve trade alignment:
• Bullish patterns trigger only if the higher timeframe shows a bullish trend (e.g., 20 EMA > 50 EMA).
• Bearish patterns trigger only if the higher timeframe trend is bearish (e.g., 20 EMA < 50 EMA).
• This confluence ensures the detected patterns align with the overall market direction.
4. Advanced Risk Management:
• Stop-loss placement now includes an option to use ATR (Average True Range) with a customizable multiplier for dynamic stop placement.
• Take-profit levels are calculated based on the specified risk/reward ratio.
• These changes provide flexibility and ensure adaptive risk management.
5. Bug Fix - math.abs:
• Replaced the incorrect use of abs with math.abs to conform with Pine Script’s syntax, ensuring error-free execution.
6. Alerts for All Patterns:
• Alerts have been updated to notify users of detected bullish or bearish patterns, including the Morning Star.
7. Cleaner Code and Documentation:
• Inline comments explain key logic, improving readability and making it easier to understand and modify the script as needed.

Summary of Features:
This enhanced script detects key candlestick patterns like engulfing, reversal, and Morning Star with added volume and trend validation. It integrates higher timeframe confluence and offers robust risk management options with ATR-based stop-losses. Perfect for traders seeking accuracy and adaptability.
Candlestick analysisChart patternsMoving Averages

Skrypt open-source

W prawdziwym duchu TradingView autor tego skryptu opublikował go jako open source, aby inwestorzy mogli go zrozumieć i zweryfikować. Pozdrowienia dla autora! Możesz go używać bezpłatnie, ale ponowne użycie tego kodu w publikacji podlega Zasadom Regulaminu. Możesz go oznaczyć jako ulubione, aby użyć go na wykresie.

Chcesz użyć tego skryptu na wykresie?

Wyłączenie odpowiedzialności