OPEN-SOURCE SCRIPT

SMPivot Gaussian Trend Strategy [Js.K]

331
This open-source strategy combines a Gaussian-weighted moving average with “Smart Money” swing-pivot breaks (BoS = Break-of-Structure) to capture trend continuations and early reversals. It is intended for educational and research purposes only and must not be interpreted as financial advice.

How the logic works
-------------------
1. Gaussian Moving Average (GMA)
• A custom Gaussian kernel (length = 30 by default) smooths price while preserving turning points.
• A second pass (“Smoothed GMA”) further filters noise; only its direction is used for bias.

2. Swing-Pivot detection
• High/Low pivots are found with a symmetric look-back/forward window (Pivot Length = 20).
• The most recent confirmed pivot creates a dynamic structure level (UpdatedHigh / UpdatedLow).

3. Entry rules
Long
• Price closes above the most recent pivot high **and** above Smoothed GMA.
Short
• Price closes below the most recent pivot low **and** below Smoothed GMA.

4. Exit rules
• Fixed stop-loss and take-profit in percent of current price (user-defined).
• Separate parameters and on/off switches for longs and shorts.

5. Visuals
• GMA (dots) and Smoothed GMA (line).
• Structure break lines plus “BoS PH/PL” labels at the midpoint between pivot and break.

Inputs
------
Gaussian
• Gaussian Length (default 30) – smoothing window.
• Gaussian Scatterplot – toggle GMA dots.

Smart-Money Pivot
• Pivot Length (default 20).
• Bull / Bear colors.

Risk settings
• Long / Short enable.
• Individual SL % and TP % (default 1 % SL, 30 % TP).
• Strategy uses percent-of-equity sizing; initial capital defaults to 10 000 USD.
Adjust these to reflect your own account size, realistic commission and slippage.

Best practice & compliance notes
--------------------------------
• Test on a data sample that yields ≥ 100 trades to obtain statistically relevant results.
• Keep risk per trade below 5–10 % of equity; the default values comply with this guideline.
• Explain any custom settings you publish that differ from the defaults.
• Do **not** remove the code header or licence notice (MPL-2.0).
• Include realistic commission and slippage in your back-test before publishing.
• The script does **not** repaint; orders are processed on bar close.

Usage
-----
1. Add the script to any symbol / timeframe; intraday and swing timeframes both work—adjust lengths accordingly.
2. Configure SL/TP and position size to match your personal risk management.
3. Run “List of trades” and the performance summary to evaluate expectancy; forward-test before live use.

Disclaimer
----------
Trading involves substantial risk. Past performance based on back-testing is not necessarily indicative of future results. The author is **not** responsible for any financial losses arising from the use of this script.

Declinazione di responsabilità

Le informazioni ed i contenuti pubblicati non costituiscono in alcun modo una sollecitazione ad investire o ad operare nei mercati finanziari. Non sono inoltre fornite o supportate da TradingView. Maggiori dettagli nelle Condizioni d'uso.