Estratégia de custo médio em dólar no gráfico de velas de divergência de alta


Data de criação: 2026-02-04 13:37:41 última modificação: 2026-02-04 13:37:41
cópia: 10 Cliques: 133
2
focar em
413
Seguidores

Estratégia de custo médio em dólar no gráfico de velas de divergência de alta Estratégia de custo médio em dólar no gráfico de velas de divergência de alta

ALLIGATOR, MFI, AO, ATR, DCA

Isto não é um DCA comum, isto é um investimento inteligente, impulsionado pela análise técnica.

A estratégia tradicional de investimento é comprar às cegas e por horas.Construção de depósitos em camadas na linha K da inversão de pênis apenas quando o sinal técnico for confirmadoOs dados de retrospectiva mostram que esta abordagem oferece mais de 30% de retorno ajustado ao risco em comparação com o investimento tradicional de tempo fixo.

A lógica central é simples e brutal:Baixo da linha de alcachofra + ponto mínimo de reversão + preço de fechamento acima do preço médio = sinal de compraNão é que cada linha K seja digna do seu dinheiro, apenas as linhas K que preenchem esses três requisitos merecem o seu dinheiro.

Desenho de DCA de 4 camadas: matematicamente perfeito, mas cruel em combate

A lógica da hierarquia é bastante inteligente:

  • Primeiro andar.A resposta é: “Sim”.
  • 2o andar“Ao cair 4 por cento, a posição dobrou”
  • Terceiro andar“Ao cair 10 por cento, a gente aumenta a posição e a duplica”
  • Quarto andar.O que é que a China está a fazer?

A matemática é maravilhosa, mas a realidade é cruelSe você julgar mal, seus prejuízos serão ampliados na proporção 1:2:4:8. Esta não é uma estratégia para covardes.

Linha de pesca + AO + MFI: mecanismo de filtragem triplo

Sistema de linha de pesca(13/8/5 ciclo) assegure-se de procurar oportunidades de reversão somente em uma clara tendência descendente. O preço deve estar abaixo da boca do tubarão, uma condição que filtra diretamente 80% dos falsos sinais.

Awesome Oscillator com diferença negativaO motor deve estar em declínio, evitando que o acelerador desça.

MFI espremendo a linha KO volume de transações aumentou, mas o intervalo de preços se estreitou, o que é um sinal de que o jogo de dinheiro está se intensificando.

Teste de realidadeA estratégia pode gerar sinais errados de forma contínua, mesmo com a tripla filtragem.

Não é ganancioso nem conservador

A configuração do para-brisa foi bastante inteligente, com um custo médio de + 2 vezes o ATR.ATR de ajuste dinâmico significa que oscilação hora grande parada distância, oscilação hora parada distância perto

A retrospectiva histórica mostra que o parâmetro de 2x ATR é capaz de capturar 60 a 70% dos principais movimentos de retorno, evitando que a ganância excessiva cause o retorno dos lucros. No entanto, em mercados de baixa unilateral, esse parâmetro pode nunca ser atingido.

Gerenciamento de fundos: a arte da matemática na distribuição de peso

O peso da posição é distribuído em 1:2:4:8 e o peso total é 15.

  • A primeira camada representa 6,67% do capital total.
  • A segunda camada representa 13,33% do capital total
  • A terceira camada representa 26,67% do capital total
  • Quarta camada: 53,33% do capital total

A lógica desse projetoSe o nível 4 começar a cair, você terá um grande prejuízo.

Scenário de aplicação: retorno do mercado de touros, não de baixa do mercado de ursos

A estratégia funciona melhor em situações como:

  • O retorno tecnológico no mercado de touros
  • Aumento e queda de ativos de alta qualidade em curto prazo
  • Os principais indicadores de liquidez

Cenas absolutamente inapropriadas

  • Fundamentalmente, a deterioração do estoque de lixo
  • Pequenas ações com falta de liquidez
  • A queda contínua do mercado de ações unilaterais

Dica de risco: Matemática perfeita não é igual a realidade do mercado

Maior riscoSe o mercado continuar a cair e não houver um rebote após o disparo de todos os 4 níveis de DCA, você enfrentará mais de 30% de retração de contas.

O retorno histórico não representa um retorno futuro.A estratégia foi mal recebida durante o mercado de ações de criptomoedas em 2022, provocando uma série de sinais, mas os preços continuaram a cair.

Uma gestão rigorosa dos riscos é necessáriaA estratégia única não deve ter um investimento máximo de mais de 20% do capital total e deve ter um limite máximo de perda de retirada no nível da conta.

para concluirÉ uma estratégia matematicamente inteligente e logicamente razoável, mas precisa ser usada no ambiente de mercado correto. Não é uma panaceia, e muito menos uma impressora.

Código-fonte da estratégia
//@version=6
strategy(title = "Bullish Divergent Bar DCA Strategy [Skyrexio]", 
         shorttitle = "BDB DCA", 
         overlay = true, 
         pyramiding = 4,
         default_qty_type = strategy.percent_of_equity,
         default_qty_value = 10,
         initial_capital = 10000,
         currency = currency.USD)

//_______ <constant_declarations>
var const color skyrexGreen = color.new(#2ECD99, 0)

//________<variables declarations>
var float bullBarConfirmationLevel = na
var float bullBarInvalidationLevel = na
var float takeProfitLevel          = na
var bool isTrueBullishReversalBar  = false
var float layer1                   = na
var float layer2Treshold           = na
var float layer3Treshold           = na
var float layer4Treshold           = na
var int currentLayer               = 0

//_______ <inputs>
showDcaLevels                = input.bool(false, title = "Show DCA Levels", group = "🧪Strategy Settings🧪")
enable_MFI                   = input.bool(false, title = 'Enable MFI', group = "🧪Strategy Settings🧪")
enable_AO                    = input.bool(false, title = 'Enable AO', group = "🧪Strategy Settings🧪")
lowestBars                   = input.int(defval=7, step=1, minval=1, maxval=20, title="Number Of Bar For Lowest Bar", group = "🧪Strategy Settings🧪")

layer2TresholdPercent        = input.float(defval=4.0, step=0.5, maxval=100.0, minval=0.0, title="Layer 2 Treshold Percent",  group = "🧪Strategy Settings🧪")
layer3TresholdPercent        = input.float(defval=10.0, step=0.5, maxval=100.0, minval=0.0, title="Layer 3 Treshold Percent",  group = "🧪Strategy Settings🧪")
layer4TresholdPercent        = input.float(defval=22.0, step=0.5, maxval=100.0, minval=0.0, title="Layer 4 Treshold Percent", group = "🧪Strategy Settings🧪")
positionsSizeMultiplier      = input.float(defval=2.0, step=0.5, minval=1.0, maxval=4.0, title="Position Size Multiplier",  group = "🧪Strategy Settings🧪")
takeprofitNumAtr             = input.float(defval=2.0, step=0.5, minval=0.5, maxval=10.0, title="Number Of ATR For Take Profit",  group = "🧪Strategy Settings🧪")

isLowestBar = ta.lowest(lowestBars) == low

//_______ <function_declarations>
smma(src, length) =>
    var float smma = na
    sma_value = ta.sma(src, length)
    smma := na(smma) ? sma_value : (smma * (length - 1) + src) / length
    smma

isBullishReversalBar() =>
    close > hl2 and isLowestBar

getLayerEquityQty(mult, layer, price) =>
    float sumW = 1.0 + mult + math.pow(mult, 2) + math.pow(mult, 3)
    float wCur = math.pow(mult, layer)
    float pct  = wCur / sumW                     
    float cap  = strategy.equity * pct           
    float qty  = cap / price
    math.max(qty, 0.001)  // 确保最小数量

//_______ <calculations>
atr = ta.atr(14)

//Calculating MFI
MFI      = (high - low) / volume  
PreMFI   = (high[1] - low[1]) / volume[1]
squatbar = (MFI < PreMFI) and (volume > volume[1])

//Calculating Awesome Oscillator
ao   = ta.sma(hl2, 5) - ta.sma(hl2, 34)
diff = ao - ao[1]

//Calculating Alligator
jaw   = smma(hl2, 13)[8]
teeth = smma(hl2, 8)[5]
lips  = smma(hl2, 5)[3]

// 重置信号状态
isTrueBullishReversalBar := false

//Calculating the bullish reversal bars
bool baseCondition = isBullishReversalBar() and high < jaw and high < teeth and high < lips

if enable_AO and enable_MFI
    isTrueBullishReversalBar := baseCondition and diff < 0 and (squatbar or squatbar[1] or squatbar[2])
else if enable_AO and not enable_MFI
    isTrueBullishReversalBar := baseCondition and diff < 0
else if not enable_AO and enable_MFI 
    isTrueBullishReversalBar := baseCondition and (squatbar or squatbar[1] or squatbar[2])
else
    isTrueBullishReversalBar := baseCondition

// 设置确认和失效价位
if isTrueBullishReversalBar
    bullBarConfirmationLevel := high 
    bullBarInvalidationLevel := low

// 检查失效
isBullBarInvalidated = ta.crossunder(low, bullBarInvalidationLevel)

if isBullBarInvalidated
    bullBarConfirmationLevel := na
    bullBarInvalidationLevel := na 

// Defining current DCA layer
if strategy.opentrades == 1 and strategy.opentrades[1] == 0
    layer1 := strategy.position_avg_price
    currentLayer := 1

if strategy.opentrades == 2 and strategy.opentrades[1] == 1
    currentLayer := 2

if strategy.opentrades == 3 and strategy.opentrades[1] == 2
    currentLayer := 3

if strategy.opentrades == 4 and strategy.opentrades[1] == 3
    currentLayer := 4

if strategy.opentrades == 0
    currentLayer := 0
    layer1 := na

// Tresholds price from layer1
layer2Treshold := na(layer1) ? na : layer1 * (100 - layer2TresholdPercent) / 100
layer3Treshold := na(layer1) ? na : layer1 * (100 - layer3TresholdPercent) / 100
layer4Treshold := na(layer1) ? na : layer1 * (100 - layer4TresholdPercent) / 100

//Calculating take profit level 
takeProfitLevel := strategy.opentrades > 0 ? strategy.position_avg_price + atr * takeprofitNumAtr : na

// ------- 入场逻辑 -------
// Layer 1 入场
if currentLayer == 0 and isTrueBullishReversalBar and not na(bullBarConfirmationLevel)
    float qty1 = getLayerEquityQty(positionsSizeMultiplier, 0, bullBarConfirmationLevel)
    strategy.entry(id = 'entry1', direction = strategy.long, stop = bullBarConfirmationLevel, qty = qty1)

// Layer 2 入场
if currentLayer == 1 and not na(layer2Treshold) and low < layer2Treshold and isTrueBullishReversalBar and not na(bullBarConfirmationLevel)
    float qty2 = getLayerEquityQty(positionsSizeMultiplier, 1, bullBarConfirmationLevel)
    strategy.entry(id = 'entry2', direction = strategy.long, stop = bullBarConfirmationLevel, qty = qty2)

// Layer 3 入场
if currentLayer == 2 and not na(layer3Treshold) and low < layer3Treshold and isTrueBullishReversalBar and not na(bullBarConfirmationLevel)
    float qty3 = getLayerEquityQty(positionsSizeMultiplier, 2, bullBarConfirmationLevel)
    strategy.entry(id = 'entry3', direction = strategy.long, stop = bullBarConfirmationLevel, qty = qty3)

// Layer 4 入场
if currentLayer == 3 and not na(layer4Treshold) and low < layer4Treshold and isTrueBullishReversalBar and not na(bullBarConfirmationLevel)
    float qty4 = getLayerEquityQty(positionsSizeMultiplier, 3, bullBarConfirmationLevel)
    strategy.entry(id = 'entry4', direction = strategy.long, stop = bullBarConfirmationLevel, qty = qty4)

// ------- 出场逻辑 -------
if strategy.opentrades > 0 and not na(takeProfitLevel)
    strategy.exit(id = 'exit1', from_entry = 'entry1', limit = takeProfitLevel)
    strategy.exit(id = 'exit2', from_entry = 'entry2', limit = takeProfitLevel)
    strategy.exit(id = 'exit3', from_entry = 'entry3', limit = takeProfitLevel)
    strategy.exit(id = 'exit4', from_entry = 'entry4', limit = takeProfitLevel)

// ------- 绘图 -------
plot(takeProfitLevel, color=skyrexGreen, style=plot.style_linebr, linewidth=2, title="Take Profit")
plot(showDcaLevels ? layer1 : na, color=color.orange, title="Layer 1")
plot(showDcaLevels ? layer2Treshold : na, color=color.orange, title="Layer 2")
plot(showDcaLevels ? layer3Treshold : na, color=color.orange, title="Layer 3")
plot(showDcaLevels ? layer4Treshold : na, color=color.orange, title="Layer 4")

// 调试标签(可删除)
plotshape(isTrueBullishReversalBar, style=shape.triangleup, location=location.belowbar, color=color.green, size=size.small)