Likuiditas dinamis mendorong strategi perdagangan adaptif struktur pasar

LZ MSS SL TP ISL
Tanggal Pembuatan: 2025-03-28 17:13:02 Akhirnya memodifikasi: 2025-03-28 17:13:02
menyalin: 2 Jumlah klik: 350
2
fokus pada
319
Pengikut

Likuiditas dinamis mendorong strategi perdagangan adaptif struktur pasar Likuiditas dinamis mendorong strategi perdagangan adaptif struktur pasar

Ringkasan

Ini adalah strategi perdagangan inovatif yang menggabungkan analisis zona likuiditas dan dinamika struktur pasar internal untuk mengidentifikasi titik masuk dengan probabilitas tinggi. Strategi ini memberikan pedagang cara masuk ke pasar yang fleksibel dan akurat dengan melacak interaksi harga dengan tingkat pasar kunci dan menggunakan konversi pasar internal untuk memicu perdagangan.

Prinsip Strategi

Logika inti dari strategi ini didasarkan pada dua komponen kunci: identifikasi zona likuiditas dan konversi pasar internal. Zona likuiditas ditentukan secara dinamis dengan menganalisis titik tinggi dan rendah lokal, sedangkan konversi pasar internal didasarkan pada harga yang menerobos tingkat bullish atau bearish sebelumnya untuk menilai perubahan arah pasar.

Strategi ini memiliki fitur-fitur inti sebagai berikut:

  1. Logika konversi pasar internal: tidak bergantung pada bentuk grafik tradisional, tetapi didasarkan pada harga yang menembus tingkat kritis
  2. Pelacakan area likuiditas: identifikasi secara dinamis area likuiditas utama untuk mencegah perdagangan dalam kondisi pasar yang lemah
  3. Fleksibilitas pola: menawarkan tiga pola perdagangan “Both”, “Bullish Only” dan “Bearish Only”
  4. Manajemen risiko: Stop loss dan stop loss level yang dapat disesuaikan
  5. Pengendalian jangka waktu: dapat mengontrol periode waktu transaksi dengan tepat

Keunggulan Strategis

  1. Adaptasi Dinamis: Strategi dapat merespons perubahan struktur pasar dengan cepat
  2. Precision Entry: Peningkatan Precision Entry dengan Menggabungkan Liquidity Area dan Internal Market Conversion
  3. Pengendalian risiko: mekanisme penghentian dan penutupan yang terpasang
  4. Fleksibel: dapat memilih modus perdagangan sesuai dengan kondisi pasar yang berbeda
  5. Analisis multi-dimensi: memperhitungkan perilaku harga, likuiditas, dan struktur pasar

Risiko Strategis

  1. Pergeseran pasar yang kuat dapat menyebabkan stop loss yang dipicu
  2. Dalam pasar yang bergejolak, sinyal yang sering dapat meningkatkan biaya transaksi
  3. Pengaturan parameter yang tidak tepat dapat memengaruhi kinerja strategi
  4. Hasil pengamatan mungkin berbeda dengan yang nyata

Arah optimasi strategi

  1. Memperkenalkan algoritma pembelajaran mesin untuk optimasi penyesuaian parameter
  2. Menambahkan lebih banyak filter, seperti volume transaksi, indikator volatilitas
  3. Mengembangkan mekanisme verifikasi multi-time frame
  4. Optimalkan algoritma stop loss dan stop loss, mempertimbangkan perubahan dinamika volatilitas pasar

Meringkaskan

Ini adalah strategi perdagangan inovatif yang menggabungkan analisis likuiditas dan dinamika struktur pasar. Dengan logika konversi pasar internal yang fleksibel dan pelacakan zona likuiditas yang akurat, ini memberikan pedagang alat perdagangan yang kuat.

Kode Sumber Strategi
/*backtest
start: 2024-03-28 00:00:00
end: 2025-03-27 00:00:00
period: 1d
basePeriod: 1d
exchanges: [{"eid":"Futures_Binance","currency":"ETH_USDT"}]
*/

//@version=6
strategy("Liquidity + Internal Market Shift Strategy", overlay=true)

// ======== Mode Selection ========
mode = input.string("Both", title="Mode", options=["Both", "Bullish Only", "Bearish Only"])

// ======== Stop-Loss and Take-Profit Input (in pips) ========
enableTakeProfit = input.bool(true, title="Enable Custom Take Profit")  // Option to enable/disable take profit
stopLossPips = input.int(10, title="Stop Loss (in pips)", minval=1)  // Stop loss in pips
takeProfitPips = input.int(20, title="Take Profit (in pips)", minval=1)  // Take profit in pips

// ======== Internal Shift Logic ========

// Fixed number of consecutive candles to track (set to 1)
consecutiveBullishCount = 1
consecutiveBearishCount = 1

// Function to check for bullish and bearish candles
isBullish = close > open
isBearish = close < open

// Variables to track consecutive candles and mark lowest/highest
var int bullishCount = 0
var int bearishCount = 0
var float lowestBullishPrice = na
var float highestBearishPrice = na
var float previousBullishPrice = na // For the previous bullish lowest price
var float previousBearishPrice = na // For the previous bearish highest price

// Variables to track last internal shift type (1 = Bullish, -1 = Bearish, 0 = None)
var int lastInternalShift = 0

// Counting consecutive bullish and bearish candles
if isBullish
    bullishCount := bullishCount + 1
    bearishCount := 0
    if bullishCount == 1 or low < lowestBullishPrice
        lowestBullishPrice := low
else if isBearish
    bearishCount := bearishCount + 1
    bullishCount := 0
    if bearishCount == 1 or high > highestBearishPrice
        highestBearishPrice := high
else
    bullishCount := 0
    bearishCount := 0
    lowestBullishPrice := na
    highestBearishPrice := na

// Internal shift conditions
internalShiftBearish = close < previousBullishPrice and close < lowestBullishPrice
internalShiftBullish = close > previousBearishPrice and close > highestBearishPrice

// Condition to alternate internal shifts
allowInternalShiftBearish = internalShiftBearish and lastInternalShift != -1
allowInternalShiftBullish = internalShiftBullish and lastInternalShift != 1

// Tracking shifts
if bullishCount >= consecutiveBullishCount
    previousBullishPrice := lowestBullishPrice

if bearishCount >= consecutiveBearishCount
    previousBearishPrice := highestBearishPrice

// ======== Liquidity Seal-Off Points Logic ========
upperLiquidityLookback = input.int(10, title="Lookback Period for Upper Liquidity Line")
lowerLiquidityLookback = input.int(10, title="Lookback Period for Lower Liquidity Line")

isLocalHigh = high == ta.highest(high, upperLiquidityLookback)
isLocalLow = low == ta.lowest(low, lowerLiquidityLookback)

var bool touchedLowerLiquidityLine = false
var bool touchedUpperLiquidityLine = false

if (low <= ta.lowest(low, lowerLiquidityLookback))
    touchedLowerLiquidityLine := true

if (high >= ta.highest(high, upperLiquidityLookback))
    touchedUpperLiquidityLine := true

var bool lockedBullish = false
var bool lockedBearish = false
var int barSinceLiquidityTouch = na

// ======== Combined Signals ========
bullishSignal = allowInternalShiftBullish and touchedLowerLiquidityLine and not lockedBullish
bearishSignal = allowInternalShiftBearish and touchedUpperLiquidityLine and not lockedBearish

if bullishSignal
    lockedBullish := true
    touchedLowerLiquidityLine := false
    barSinceLiquidityTouch := 0

if bearishSignal
    lockedBearish := true
    touchedUpperLiquidityLine := false
    barSinceLiquidityTouch := 0

if not na(barSinceLiquidityTouch)
    barSinceLiquidityTouch := barSinceLiquidityTouch + 1

if barSinceLiquidityTouch >= 3
    lockedBullish := false
    lockedBearish := false

if touchedLowerLiquidityLine
    lockedBullish := false

if touchedUpperLiquidityLine
    lockedBearish := false

// ======== Plot Combined Signals ========
plotshape(bullishSignal, style=shape.triangleup, location=location.belowbar, color=color.green, size=size.tiny, title="Bullish Signal")
plotshape(bearishSignal, style=shape.triangledown, location=location.abovebar, color=color.red, size=size.tiny, title="Bearish Signal")

plot(isLocalHigh ? high : na, color=color.red, linewidth=2, style=plot.style_stepline, title="Local High Line")
plot(isLocalLow ? low : na, color=color.green, linewidth=2, style=plot.style_stepline, title="Local Low Line")

// ======== Track Entry and Opposing Signals ========
var float entryPrice = na
var int entryTime = na
var string positionSide = ""

// ======== Strategy Execution (Mode Logic) ========
if (mode == "Both")
    // Short Entry Logic (Bearish Signal)
    if (bearishSignal and na(entryPrice))
        strategy.entry("Short", strategy.short)
        entryPrice := close
        entryTime := time
        positionSide := "short"
    
    // Long Entry Logic (Bullish Signal)
    if (bullishSignal and na(entryPrice))
        strategy.entry("Long", strategy.long)
        entryPrice := close
        entryTime := time
        positionSide := "long"

    // Exit Logic: Close on Opposing Signal (after the current signal is triggered)
    if (positionSide == "short" and bullishSignal )
        strategy.close("Short")
        entryPrice := na
        positionSide := ""
    
    if (positionSide == "long" and bearishSignal)
        strategy.close("Long")
        entryPrice := na
        positionSide := ""
    
    // Stop-Loss and Take-Profit Logic (in pips)
    stopLossPriceLong = entryPrice - stopLossPips * syminfo.mintick
    takeProfitPriceLong = entryPrice + takeProfitPips * syminfo.mintick
    stopLossPriceShort = entryPrice + stopLossPips * syminfo.mintick
    takeProfitPriceShort = entryPrice - takeProfitPips * syminfo.mintick
    
    // Long Stop-Loss and Take-Profit Conditions
    if (positionSide == "long" and close <= stopLossPriceLong)
        strategy.close("Long", comment="Stop Loss Triggered")
        entryPrice := na
        positionSide := ""

    if (positionSide == "long" and enableTakeProfit and close >= takeProfitPriceLong)
        strategy.close("Long", comment="Take Profit Triggered")
        entryPrice := na
        positionSide := ""

    // Short Stop-Loss and Take-Profit Conditions
    if (positionSide == "short" and close >= stopLossPriceShort)
        strategy.close("Short", comment="Stop Loss Triggered")
        entryPrice := na
        positionSide := ""

    if (positionSide == "short" and enableTakeProfit and close <= takeProfitPriceShort)
        strategy.close("Short", comment="Take Profit Triggered")
        entryPrice := na
        positionSide := ""

if (mode == "Bullish Only")
    if (bullishSignal and na(entryPrice))
        strategy.entry("Long", strategy.long)
        entryPrice := close
        entryTime := time
        positionSide := "long"
    
    if (positionSide == "long" and bearishSignal)
        strategy.close("Long")
        entryPrice := na
        positionSide := ""

    // Stop-Loss and Take-Profit Logic (in pips)
    stopLossPriceLong = entryPrice - stopLossPips * syminfo.mintick
    takeProfitPriceLong = entryPrice + takeProfitPips * syminfo.mintick
    
    if (positionSide == "long" and close <= stopLossPriceLong)
        strategy.close("Long", comment="Stop Loss Triggered")
        entryPrice := na
        positionSide := ""

    if (positionSide == "long" and enableTakeProfit and close >= takeProfitPriceLong)
        strategy.close("Long", comment="Take Profit Triggered")
        entryPrice := na
        positionSide := ""

if (mode == "Bearish Only")
    if (bearishSignal and na(entryPrice))
        strategy.entry("Short", strategy.short)
        entryPrice := close
        entryTime := time
        positionSide := "short"
    
    if (positionSide == "short" and bullishSignal)
        strategy.close("Short")
        entryPrice := na
        positionSide := ""

    // Stop-Loss and Take-Profit Logic (in pips)
    stopLossPriceShort = entryPrice + stopLossPips * syminfo.mintick
    takeProfitPriceShort = entryPrice - takeProfitPips * syminfo.mintick
    
    if (positionSide == "short" and close >= stopLossPriceShort)
        strategy.close("Short", comment="Stop Loss Triggered")
        entryPrice := na
        positionSide := ""

    if (positionSide == "short" and enableTakeProfit and close <= takeProfitPriceShort)
        strategy.close("Short", comment="Take Profit Triggered")
        entryPrice := na
        positionSide := ""