OPEN-SOURCE SCRIPT

Azlan MA Silang PLUS++

Overview
Azlan MA Silang PLUS++ is an advanced moving average crossover trading indicator designed for traders who want to jump back into the market when they missed their first opportunity to take a trade. It implements a sophisticated dual moving average system with customizable settings and re-entry signals, making it suitable for both trend following and swing trading strategies.

Key Features
• Dual Moving Average System with multiple MA types (EMA, SMA, WMA, LWMA)
• Customizable price sources for each moving average
• Smart re-entry system with configurable maximum re-entries
• Visual signals with background coloring and shape markers
• Comprehensive alert system for both initial and re-entry signals
• Flexible parameter customization through input options

Input Parameters
Moving Average Configuration
• MA1 Type: Choice between SMA, EMA, WMA, LWMA (default: EMA)
• MA2 Type: Choice between SMA, EMA, WMA, LWMA (default: EMA)
• MA1 Length: Minimum value 1 (default: 8)
• MA2 Length: Minimum value 1 (default: 15)
• MA1 & MA2 Shift: Offset values for moving averages
• Price Sources: Configurable for each MA (Open, High, Low, Close, HL/2, HLC/3, HLCC/4)

Re-entry System
• Enable/Disable re-entry signals
• Maximum re-entries allowed (default: 3)

Technical Implementation
Price Source Calculation
The script implements a flexible price source system through the price_source() function:
• Supports standard OHLC values
• Includes compound calculations (HL/2, HLC/3, HLCC/4)
• Defaults to close price if invalid source specified

Moving Average Types
Implements four MA calculations:
1. SMA (Simple Moving Average)
2. EMA (Exponential Moving Average)
3. WMA (Weighted Moving Average)
4. LWMA (Linear Weighted Moving Average)

Signal Generation Logic
Initial Signals
• Buy Signal: MA1 crosses above MA2 with price above both MAs
• Sell Signal: MA1 crosses below MA2 with price below both MAs

Re-entry Signals
Re-entry system activates when:
1. Price crosses under MA1 in buy mode (or over in sell mode)
2. Price returns to cross back over MA1 (or under for sells)
3. Position relative to MA2 confirms trend direction
4. Number of re-entries hasn't exceeded maximum allowed

Visual Components
• MA1: Blue line (width: 2)
• MA2: Red line (width: 2)
• Background Colors:
o Green (60% opacity): Bullish conditions
o Red (60% opacity): Bearish conditions
• Signal Markers:
o Initial Buy/Sell: Up/Down arrows with "BUY"/"SELL" labels
o Re-entry Buy/Sell: Up/Down arrows with "RE-BUY"/"RE-SELL" labels

Alert System
Generates alerts for:
• Initial buy/sell signals
• Re-entry opportunities
• Alerts include ticker and timeframe information
• Configured for once-per-bar-close frequency

Usage Tips
1. Moving Average Selection
o Shorter periods (MA1) capture faster moves
o Longer periods (MA2) identify overall trend
o EMA responds faster to price changes than SMA

2. Re-entry System
o Best used in strong trending markets
o Limit maximum re-entries based on market volatility
o Monitor price action around MA1 for potential re-entry points

3. Risk Management
o Use additional confirmation indicators
o Set appropriate stop-loss levels
o Consider market conditions when using re-entry signals

Code Structure
The script follows a modular design with distinct sections:
1. Input parameter definitions
2. Helper functions for price and MA calculations
3. Main signal generation logic
4. Visual elements and plotting
5. Alert system implementation
This organization makes the code maintainable and easy to modify for custom needs.

azlaneducationalMoving AveragesmovingaveragecrossoversilangTrend Analysis

סקריפט קוד פתוח

ברוח TradingView אמיתית, מחבר הסקריפט הזה פרסם אותו בקוד פתוח, כך שסוחרים יוכלו להבין ולאמת אותו. כל הכבוד למחבר! אתה יכול להשתמש בו בחינם, אבל השימוש החוזר בקוד זה בפרסום כפוף לכללי הבית. אתה יכול להכניס אותו למועדפים כדי להשתמש בו בגרף.

רוצה להשתמש בסקריפ זה בגרף?

כתב ויתור