OPEN-SOURCE SCRIPT

atr stop loss for double SMA v6

296
Strategy Name
atr stop loss for double SMA v6
Credit: This v6 update is based on Daveatt’s “BEST ATR Stop Multiple Strategy.”
Core Logic

Entry: Go long when the 15-period SMA crosses above the 45-period SMA; go short on the inverse cross.

Stop-Loss: On entry, compute ATR(14)×2.0 and set a fixed stop at entry ± that amount. Stop remains static until hit.

Trend Tracking: Uses barssince() to ensure only one active long or short position; stop is only active while that trend persists.

Visualization

Plots fast/slow SMA lines in teal/orange.

On each entry bar, displays a label showing “ATR value” and “ATR×multiple” positioned at the 30-bar low (long) or high (short).

Draws an “×” at the stop-price level in green (long) or red (short) while the position is open.

Execution Settings

Initial Capital: $100 000, Size = 100 shares per trade.

Commission: 0.075% per trade.

Pyramiding: 1.

Calculations: Only on bar close (no intra-bar ticks).

Usage Notes

Static ATR stop adapts to volatility but does not trail.

Ideal for trending, liquid markets (stocks, futures, FX).

Adjust SMA lengths or ATR multiple for faster/slower signals.

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.