f10409

Strategy Based on trends evaluated at different time resolutions

f10409 Atualizado   
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 雷公.
Notas de Lançamento:
some bugs fixed
Notas de Lançamento:
Remove sma based s/m and m/l from chart
Notas de Lançamento:
bugs fixed
Notas de Lançamento:
0405
Notas de Lançamento:
add input for stop loss
Script protegido
Este script é publicado como de código fechado e você pode usá-lo livremente. Você pode favoritá-lo para utilizá-lo em um gráfico. Você não pode visualizar ou modificar seu código fonte.
Aviso legal

As informações e publicações não devem ser e não constituem conselhos ou recomendações financeiras, de investimento, de negociação ou de qualquer outro tipo, fornecidas ou endossadas pela TradingView. Leia mais em Termos de uso.

Quer usar esse script no gráfico?