OPEN-SOURCE SCRIPT

Strategy - MA10 & MA20 Exact Crossover Strategy

Focused Entry on Crossover:

The long position is entered precisely when the 10-period moving average crosses above the 20-period moving average using the ta.crossover(ma10, ma20) condition.
This ensures the strategy only acts on the exact cross.
Exit on Crossunder:

The position is exited when the 10-period moving average crosses below the 20-period moving average, using the ta.crossunder(ma10, ma20) condition.
This keeps the strategy flat until the next crossover occurs.
Removed Additional Conditions:

The "surfing conditions" (price near moving averages, convergence) and momentum threshold are removed since they aren't relevant for exact crossover behavior.
Preserved Backtesting Date Range:

Trades are filtered to occur only within the specified start_date and end_date.
Preserved Visuals:

The 10-period and 20-period moving averages are plotted as ma10 (blue) and ma20 (red), providing clear visual confirmation of crossover events.
Trend Analysis

Script open-source

Dans le plus pur esprit TradingView, l'auteur de ce script l'a publié en open-source, afin que les traders puissent le comprendre et le vérifier. Bravo à l'auteur! Vous pouvez l'utiliser gratuitement, mais la réutilisation de ce code dans une publication est régie par nos Règles. Vous pouvez le mettre en favori pour l'utiliser sur un graphique.

Vous voulez utiliser ce script sur un graphique ?

Clause de non-responsabilité