OPEN-SOURCE SCRIPT

tunnel trading beta

Atualizado
The original author of the tunnel trading system: youtuber:Teacher Jin
This is a set of indicators system that trades completely based on the moving average. It belongs to the right trading. The idea is as follows:
(1) Basic trend (major trend)
When the short-term moving average is higher than the long-term moving average, it is an upward trend; otherwise, it is a downward trend.
The tentative short-term moving average is ema12, and the long-term moving average is ema169.

(2) The first type of buying point (or short point): trend establishment
Starting from the bar where the uptrend is established, the first outgoing bar is the first buying point. (Outgoing means that the closing price is higher than the opening price and higher than the high point of the previous bar)
Starting from the bar where the downtrend is established, the first bar to fall is the first shorting point. (Fall means that the closing price is lower than the opening price and lower than the low point of the previous bar)

(3) The second type of buying point (or short point): the buying point when pulling back (or the short point when rebounding)
The buying point at the time of pullback (callback) means that the general trend is up, but the small trend is down. You can buy when it is clear that the down trend is over.
Two concepts need to be defined here: "pullback (callback)" and "end of down trend". The definition of pullback is that when the general trend is rising, bar falls below the long-term moving average, and at this time the short-term moving average is still higher than the long-term moving average; The definition of the end of a down trend is that it is outgoing and ema12 is on the rise.
In the same way, we can know what is the "short point when rebounding":
The big trend is down, but the small trend is up. When it is clear that the rise is over, you can go short.

(4) Setting of Stop Loss and Take Profit
When going long:
Stop Loss Price: The low point of a bar before the buying point.
Stop-profit price: After the stop-loss price is determined, the profit-loss ratio is 3:1 to determine the stop-profit price. (The default value is 3, the user can modify it)
When shorting:
Stop Loss Price: The high point of a bar before the purchase point.
Stop-profit price: After the stop-loss price is determined, the profit-loss ratio is 3:1 to determine the stop-profit level. (The default value is 3, the user can modify it)

Chinese introduction:
隧道交易体系的原作者:油管金老师看盘室
这是一套完全根据均线进行交易的指标体系,属于右侧交易,思路如下:
(1) 基本趋势(大趋势)
短期均线高于长期均线时,是上涨趋势;反之,是下降趋势。
暂定短期均线为ema12,长期均线为ema169。

(2) 第一种买入点(或做空点):趋势确立
从上涨趋势确立的那根bar开始,第一个出头的bar,是第一买入点。(出头,是指收盘价高于开盘价,且高于前一根bar的高点)
从下降趋势确立的那根bar开始,第一个落尾的bar,是第一做空点。(落尾,是指收盘价低于开盘价,且低于前一根bar的低点)

(3) 第二种买入点(或做空点):拉回时的买入点(或反弹时的做空点)
拉回时(回调时)的买入点,是指大趋势是上涨,但小趋势是下跌,当明确下跌结束时,可以买入。
这里需要定义2个概念:“拉回(回调)”和“下跌结束”。拉回的定义是,大趋势是上涨时,bar跌破长期均线,此时短期均线仍高于长期均线;下跌结束的定义是,出头且ema12在上升。
同理可知什么是“反弹时的做空点”:
大趋势是下跌,但小趋势是上涨,当明确上涨结束时,可以做空。

(4) 止损位和止盈位的设置
做多时:
止损位:买入点前一根bar的低点。
止盈位:止损位确定后,按盈亏比3:1确定止盈位。(默认值为3,用户可以修改)

做空时:
止损位:买入点前一根bar的高点。
止盈位:止损位确定后,按盈亏比3:1确定止盈位。(默认值为3,用户可以修改)

Notas de Lançamento
The previous version script does not handle the last 30 bars, but this version solves this bug.
Notas de Lançamento
Use ATR to set excessive take-profit and stop-loss ranges.
Notas de Lançamento
The order strategy is included in the comments.
Trend Analysis

Script de código aberto

No verdadeiro espírito do TradingView, o autor desse script o publicou como código aberto, para que os traders possam compreendê-lo e analisá-lo. Parabéns ao autor! Você pode usá-lo gratuitamente, mas a reutilização desse código em publicações é regida pelas Regras da Casa. Você pode favoritá-lo para usá-lo em um gráfico.

Quer usar esse script no gráfico?

Aviso legal