f10409

Strategy Based on trends evaluated at different time resolutions

f10409 Mis à jour   
The trends are evaluated using moving averages (both EMA and SMA ) with different periods and time resolutions.
The default resolutions for the small, median, and large resolutions are day(D), week(W), and month(M), respectively.
And the default periods for the short, median, and long periods are moving averages are 20, 60, and 120, respectively.

The buy signal is triggered when the following conditions are all met:

@ Small resolution:
1. The distances between the short-period MA (s) and median-term MA (m), and between the median-period MA and long-term MA (l), are small (default: 0% < (1-s/m) and (1-m/l) < 5%).
2. Prices (c) > s, m, and l. i.e. c/s, c/m, and c/l > 1.0.
3. up-trends of s, m, and l.

@ Median resolution:
1. The distances between the short-period MA (s) and median-term MA (m), and between the median-period MA and long-term MA (l), are small (default: abs(1-s/m) < 3% and abs(1-m/l) < 5%).
2. Prices (c) > s, m, and l. i.e. c/s, c/m, and c/l > 1.0.
3. up-trends of s.

@ Large resolution:
1. The distances between the short-period MA (s) and median-term MA (m), and between the median-period MA and long-term MA (l), are small (default: abs(1-s/m) < 3% and abs(1-m/l) < 5%).
2. Prices (c) > s, m, and l. i.e. c/s, c/m, and c/l > 1.0.
3. Up-trend of s.

The close signal is triggered when the following conditions are all met:

@ Small resolution:
1. Prices (c) < s.
2. Down-trend of s.

On the separated chart, the s/m for different time resolutions are shown. The dotted line is the s/m calculated using EMA for the small time resolution.
The orange triangles represent when the prices are larger than all moving averages.
One can choose to have the m/l also plotted from the settings.

Attention:
1. The strategy needs to display at the smallest time resolution set in order to get correct results.
2. This strategy is for learning purpose only. Using it to make trading decisions will lead to money loss.

The design concepts are mostly inspired by 雷公.
Notes de version:
some bugs fixed
Notes de version:
Remove sma based s/m and m/l from chart
Notes de version:
bugs fixed
Notes de version:
0405
Notes de version:
add input for stop loss
Script protégé
Ce script est publié en code source fermé et vous pouvez l'utiliser librement. Vous pouvez le préférer pour l'utiliser sur un graphique. Vous ne pouvez pas visualiser ou modifier son code source.
Clause de non-responsabilité

Les informations et les publications ne sont pas destinées à être, et ne constituent pas, des conseils ou des recommandations en matière de finance, d'investissement, de trading ou d'autres types de conseils fournis ou approuvés par TradingView. Pour en savoir plus, consultez les Conditions d'utilisation.

Vous voulez utiliser ce script sur un graphique ?