OPEN-SOURCE SCRIPT

MA wiht Logistic [Jsk]

177
This script is published for educational purposes only and does not constitute financial advice. Past performance does not guarantee future results. Trade at your own risk; the author accepts no liability for any financial loss incurred.

Concept
• Direction is defined by the relationship between price and two moving averages (Fast & Slow).
Long: Close > Fast MA > Slow MA
Short: Close < Fast MA < Slow MA
• Three independent exit modes are available:
1) None – positions are closed only when an opposite signal appears.
2) Percentage – fixed take-profit / stop-loss expressed in % of entry price (default +20 % / –5 %).
3) Logistic – a dynamic take-profit / stop-loss based on a logistic transformation of unrealised P&L.

Key Inputs
• MA Type: EMA, SMA or WMA
• Fast / Slow MA length
• Exit Mode: None | Percentage | Logistic
• Percentage TP / SL values (active when Exit Mode = Percentage)
• Logistic settings: slope k, midpoint, TP / SL probability thresholds (active when Exit Mode = Logistic)

Recommended Use
The script works on any market or timeframe, but MA-based trend filters usually perform better in assets with smooth, directional moves. Always verify results in the Strategy Tester and account for commissions and slippage.

Disclaimer

The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.