OPEN-SOURCE SCRIPT

DOMINION

180


Here's a breakdown of what the code does:

1. **Indicators Used**:
- SMA 9 (red line)
- SMA 50 (blue line)
- SMA 180 (white line)
- EMA 20 (yellow line)

2. **Input Parameters**:
- `smaInput1 = 9`: First SMA period (editable)
- `smaInput2 = 50`: Second SMA period (editable)
- `smaInput3 = 180`: Third SMA period (editable)
- `emaInput1 = 20`: EMA period (editable)
- `no = 3`: Lookback period for swing high/low calculation
- `Barcolor`: Toggle for bar coloring
- `Bgcolor`: Toggle for background coloring

3. **Buy/Sell Signal System**:
- Uses a swing-based trailing stop loss (TSL) system
- `res`: Highest high over 'no' periods
- `sup`: Lowest low over 'no' periods
- Buy signal: When price crosses above the trailing stop
- Sell signal: When price crosses below the trailing stop
- Visual indicators:
- Green up arrow for Buy signals
- Red down arrow for Sell signals
- Green/red line for the trailing stop level
- Optional bar and background coloring

4. **Logic Breakdown**:
- `avd`: Determines trend direction (1 for up, -1 for down, 0 for neutral)
- `avn`: Captures the last significant trend direction
- `tsl`: Sets trailing stop level based on trend direction
- Color coding:
- Green when price is above TSL
- Red when price is below TSL

5. **Features**:
- Plots all moving averages as an overlay on price chart
- Shows entry/exit signals with arrows
- Includes alert conditions for Buy and Sell signals
- Customizable colors and visibility of elements

This is a trend-following system that:
- Uses multiple timeframe moving averages for trend confirmation
- Implements a swing-based trailing stop for trade management
- Provides clear visual signals for entries and exits

Wyłączenie odpowiedzialności

Informacje i publikacje przygotowane przez TradingView lub jego użytkowników, prezentowane na tej stronie, nie stanowią rekomendacji ani porad handlowych, inwestycyjnych i finansowych i nie powinny być w ten sposób traktowane ani wykorzystywane. Więcej informacji na ten temat znajdziesz w naszym Regulaminie.