A estratégia de reversão de tendência é uma combinação de estratégias que combinam os benefícios da estratégia de reversão e da estratégia de ruptura, com o objetivo de emitir um sinal de negociação no ponto de reversão da tendência. A estratégia primeiro julga se o preço apresenta uma forma de reversão por dois dias consecutivos, enquanto o indicador Stochastic Oscillator emite um sinal de reversão, que, se for o caso, produz um sinal de compra ou venda.
A estratégia consiste em duas partes:
Julgar a inversão de preços em dois dias consecutivos ((comprar no dia 2 quando o preço de fechamento é maior que o dia 1, quando a linha rápida está abaixo da linha lenta; vender no dia 2 quando o preço de fechamento é menor que o dia 1, quando a linha rápida é maior que a linha lenta))
Determine se o preço ultrapassou o preço mais alto do ciclo look_bak (se o preço ultrapassou o preço mais alto, compre).
Quando os sinais da parte invertida e da parte rompida são sincronizados (por exemplo, a parte invertida mostra um sinal de compra e a parte rompida também mostra um sinal de compra), um sinal de compra ou venda real é gerado.
Esta estratégia de combinação combina os benefícios das estratégias de negociação de reversão e de ruptura de tendência para capturar os sinais com maior precisão nos pontos de reversão de tendência.
A parte de reversão pode emitir um sinal quando o preço se reverte, apropriado para capturar pontos de inflexão.
A parte de ruptura garante que a direção do sinal de negociação esteja de acordo com a tendência, evitando a direção errada de negociação.
Quando as duas partes emitem sinais em simultâneo, é possível gerar oportunidades de negociação mais confiáveis.
A aplicação de indicadores estocásticos evita a subjetividade de julgamentos baseados apenas na forma do preço.
A estratégia também apresenta alguns riscos que devem ser lembrados:
O sinal de reversão pode ser uma falsa ruptura e não é possível determinar se a tendência de reversão foi estabelecida.
O sinal de ruptura pode ser ilusório, não sendo possível determinar se a tendência já começou.
A configuração incorreta dos parâmetros dos dois indicadores pode levar a oportunidades de negociação perdidas.
A frequência de transações pode ser excessiva, podendo ser ajustada de forma apropriada para controlar o número de transações.
Correspondência de melhorias:
Optimizar os parâmetros do indicador de inversão para garantir que o sinal de inversão seja mais confiável.
Optimizar os parâmetros de ruptura para evitar a ruptura ilusória.
Ajustar as configurações dos parâmetros das partes de reversão e ruptura para encontrar a melhor correspondência.
Ajustar a frequência das transações para evitar transações excessivamente frequentes.
A estratégia de reversão de tendência utiliza a combinação de vantagens de reversão e estratégia de ruptura de tendência para emitir sinais de negociação confiáveis em pontos de mudança de preço. Otimizando os parâmetros, pode aumentar a qualidade do sinal e capturar oportunidades de negociação confiáveis, enquanto controla a frequência de negociação. A estratégia é, em geral, mais robusta, mas é necessário ter cuidado para evitar o risco de falsas rupturas e rupturas ilusórias.
The Reversal Breakout Trend strategy is a combo strategy that combines the advantages of reversal and breakout strategies to generate trading signals at trend reversal points. It first judges if prices reverse during two consecutive days and if the Stochastic Oscillator gives reversal signals. At the same time, it also checks if prices break through the highest/lowest prices over a certain period. When reversal and breakout conditions are met, trading signals are generated.
The strategy consists of two parts:
It judges if prices reverse during two consecutive days (buy when close of day 2 is higher than day 1 and Stochastic fast line is lower than slow line; sell when close of day 2 is lower than day 1 and fast line is higher than slow line).
It judges if prices break through the highest price over the look_bak period (buy if price breaks through the highest price).
When reversal and breakout parts give signals in the same direction (e.g. reversal shows buy and breakout shows buy), actual buy/sell signals are generated.
This combo strategy combines the pros of reversal and trend breakout strategies and can more accurately capture signals at trend turning points:
The reversal part can generate signals when prices reverse, suitable to catch turning points.
The breakout part ensures trade direction is aligned with the trend, avoiding trading in wrong direction.
Signals in the same direction from both parts create more reliable trading opportunities.
The application of Stochastic avoids the subjectivity of judging by price pattern alone.
There are also some risks to note:
Reversal signals may be false breakouts, unable to confirm the reversal trend has established.
Breakout signals may be false breakouts, unable to judge the trend has started.
Improper parameter settings of the two parts may lead to missing trades.
High trading frequency may occur and needs to be controlled.
Possible optimizations:
Optimize parameters of reversal indicators to ensure reversal signals are more reliable.
Optimize breakout parameters to avoid false breakouts.
Adjust parameters of both parts to find the optimal match.
Moderate the trading frequency to prevent over-trading.
The Reversal Breakout Trend strategy leverages the strengths of reversal and trend breakout strategies and reliably generates trading signals at turning points. Through parameter optimization, it can improve signal quality and capture solid trading opportunities while controlling trading frequency. Overall this strategy is robust but false breakouts remain a risk to watch out for. Proper optimization and parameter tuning is key.
[/trans]
/*backtest
start: 2023-09-29 00:00:00
end: 2023-10-06 00:00:00
period: 45m
basePeriod: 5m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=3
////////////////////////////////////////////////////////////
// Copyright by HPotter v1.0 26/06/2019
// This is combo strategies for get a cumulative signal.
//
// First strategy
// This System was created from the Book "How I Tripled My Money In The
// Futures Market" by Ulf Jensen, Page 183. This is reverse type of strategies.
// The strategy buys at market, if close price is higher than the previous close
// during 2 days and the meaning of 9-days Stochastic Slow Oscillator is lower than 50.
// The strategy sells at market, if close price is lower than the previous close price
// during 2 days and the meaning of 9-days Stochastic Fast Oscillator is higher than 50.
//
// Second strategy
// Breakout Range Long Strategy
//
// WARNING:
// - For purpose educate only
// - This script to change bars colors.
////////////////////////////////////////////////////////////
Reversal123(Length, KSmoothing, DLength, Level) =>
vFast = sma(stoch(close, high, low, Length), KSmoothing)
vSlow = sma(vFast, DLength)
pos = 0.0
pos := iff(close[2] < close[1] and close > close[1] and vFast < vSlow and vFast > Level, 1,
iff(close[2] > close[1] and close < close[1] and vFast > vSlow and vFast < Level, -1, nz(pos[1], 0)))
pos
BreakoutRangeLong(look_bak) =>
pos = 0
xHighest = highest(high, look_bak)
pos := iff(high > xHighest[1], 1, 0)
pos
strategy(title="Combo Backtest 123 Reversal & Breakout Range Long", shorttitle="Combo", overlay = true)
Length = input(14, minval=1)
KSmoothing = input(1, minval=1)
DLength = input(3, minval=1)
Level = input(50, minval=1)
//-------------------------
look_bak = input(4, minval=1, title="Look Bak")
reverse = input(false, title="Trade reverse")
posReversal123 = Reversal123(Length, KSmoothing, DLength, Level)
posBreakoutRangeLong = BreakoutRangeLong(look_bak)
pos = iff(posReversal123 == 1 and posBreakoutRangeLong == 1 , 1,
iff(posReversal123 == -1 and posBreakoutRangeLong == -1, -1, 0))
possig = iff(reverse and pos == 1, -1,
iff(reverse and pos == -1, 1, pos))
if (possig == 1)
strategy.entry("Long", strategy.long)
if (possig == -1)
strategy.entry("Short", strategy.short)
if (possig == 0)
strategy.close_all()
barcolor(possig == -1 ? red: possig == 1 ? green : blue )