f10409

Strategy Based on trends evaluated at different time resolutions

f10409 Aktualisiert   
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 雷公.
Versionshinweise:
some bugs fixed
Versionshinweise:
Remove sma based s/m and m/l from chart
Versionshinweise:
bugs fixed
Versionshinweise:
0405
Versionshinweise:
add input for stop loss
Geschütztes Skript
Dieses Skript wird als Closed-Source veröffentlicht und Sie können es frei verwenden. Sie können es favorisieren, um es auf dem Chart zu verwenden. Sie können den Quellcode nicht einsehen oder verändern.
Haftungsausschluss

Die Informationen und Veröffentlichungen sind nicht als Finanz-, Anlage-, Handels- oder andere Arten von Ratschlägen oder Empfehlungen gedacht, die von TradingView bereitgestellt oder gebilligt werden, und stellen diese nicht dar. Lesen Sie mehr in den Nutzungsbedingungen.

Möchten Sie dieses Skript auf einem Chart verwenden?