
Chiến lược phá vỡ hai bờ biển kết hợp chiến lược phá vỡ của luật giao dịch bờ biển và nguyên tắc dừng chân di động của Linda Raschke, với khả năng phá vỡ tuyệt vời và kiểm soát rủi ro nghiêm ngặt. Chiến lược này đồng thời theo dõi sự phá vỡ lên và xuống của giá, thiết lập vị trí mua hoặc bán khi phá vỡ xảy ra và sử dụng vị trí quản lý dừng chân di động và dừng chân di động.
Logic cốt lõi là tháo lỗ khi phá vỡ chu kỳ nhỏ ở mức cao của chu kỳ lớn, và tháo lỗ khi phá vỡ chu kỳ nhỏ ở mức thấp của chu kỳ lớn. Sau khi đặt vị trí, đặt dừng di chuyển và dừng di chuyển, trước tiên xác nhận rủi ro. Khi số lượng vị trí tích lũy đến số lượng dừng được đặt, hãy hủy lệnh dừng trong chu kỳ tiếp theo, sau đó ra khỏi vị trí và đặt dừng di chuyển và dừng di chuyển để khóa lợi nhuận và theo dõi chênh lệch giá.
Bước đi cụ thể là:
Đây là một chiến lược đột phá toàn diện với những ưu điểm sau:
Các rủi ro và biện pháp ứng phó chính là:
Chiến lược này cũng có thể được tối ưu hóa theo các khía cạnh sau:
Chiến lược phá vỡ hai bờ biển sử dụng tổng hợp kỹ thuật hai chu kỳ, lý thuyết phá vỡ và phương pháp quản lý rủi ro nghiêm ngặt, trong khi vẫn giữ tỷ lệ thắng cao cũng đảm bảo sự ổn định của thu nhập. Mô hình chiến lược đơn giản, rõ ràng, dễ hiểu và áp dụng, là một chiến lược định lượng rất tốt. Chiến lược này cũng có rất nhiều không gian tối ưu hóa, nhà đầu tư có thể đổi mới trên cơ sở này để tạo ra một hệ thống giao dịch tốt hơn.
/*backtest
start: 2022-11-21 00:00:00
end: 2023-11-27 00:00:00
period: 1d
basePeriod: 1h
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=3
strategy(title = "Turtle soup plus one", shorttitle = "Turtle soup plus one", overlay=true)
bigPeriod = input(20)
smallPeriod = input(4)
takeProfitBars = input(0)
trailingStop = input(5, title = "Trailing stop percentages")
if (strategy.position_size == 0)
strategy.cancel("Long")
strategy.cancel("Short")
strategy.cancel("Stop")
stopLossPrice = 0.1
stopLossPrice := nz(stopLossPrice[1])
takeProfitStarted = false
takeProfitStarted := nz(takeProfitStarted[1])
prevHigh = highest(high, bigPeriod - smallPeriod)[smallPeriod]
smallPeriodHigh = highest(high, smallPeriod - 1)[1]
if (high > prevHigh and prevHigh > smallPeriodHigh and close > prevHigh and strategy.position_size == 0)
strategy.order("Short", strategy.short, stop = prevHigh)
if strategy.position_size < 0 and strategy.position_size[1] == 0
stopLossPrice := high[1]
strategy.order("Stop", strategy.long, qty = -strategy.position_size, stop = stopLossPrice)
takeProfitStarted := false
if (strategy.position_size < 0 and sum(strategy.position_size, takeProfitBars) == strategy.position_size * takeProfitBars and close < strategy.position_avg_price and not takeProfitStarted)
takeProfitStarted := true
strategy.cancel("Stop")
strategy.order("ExitHalf", strategy.long, qty = ceil(-strategy.position_size / 2), stop = close)
if (strategy.position_size != -1)
strategy.exit("ExitFull", "Short", qty = -strategy.position_size - ceil(-strategy.position_size / 2), loss = stopLossPrice, trail_price = close, trail_offset = -(close - strategy.position_avg_price) * trailingStop / 100 / syminfo.mintick)
prevLow = lowest(low, bigPeriod - smallPeriod)[smallPeriod]
smallPeriodLow = lowest(low, smallPeriod - 1)[1]
if (low < prevLow and prevLow < smallPeriodLow and close < prevLow and strategy.position_size == 0)
strategy.order("Long", strategy.long, stop = prevLow)
if strategy.position_size > 0 and strategy.position_size[1] == 0
stopLossPrice := low[1]
strategy.order("Stop", strategy.short, qty = strategy.position_size, stop = stopLossPrice)
takeProfitStarted := false
if (strategy.position_size > 0 and sum(strategy.position_size, takeProfitBars) == strategy.position_size * takeProfitBars and close > strategy.position_avg_price and not takeProfitStarted)
takeProfitStarted := true
strategy.cancel("Stop")
strategy.order("ExitHalf", strategy.short, qty = ceil(strategy.position_size / 2), stop = close)
if (strategy.position_size != 1)
strategy.exit("ExitFull", "Long", qty = strategy.position_size - ceil(strategy.position_size / 2),loss = stopLossPrice, trail_price = close, trail_offset = (close - strategy.position_avg_price) * trailingStop / 100 / syminfo.mintick)
// === Backtesting Dates ===
testPeriodSwitch = input(false, "Custom Backtesting Dates")
testStartYear = input(2018, "Backtest Start Year")
testStartMonth = input(3, "Backtest Start Month")
testStartDay = input(6, "Backtest Start Day")
testStartHour = input(08, "Backtest Start Hour")
testPeriodStart = timestamp(testStartYear,testStartMonth,testStartDay,testStartHour,0)
testStopYear = input(2038, "Backtest Stop Year")
testStopMonth = input(12, "Backtest Stop Month")
testStopDay = input(14, "Backtest Stop Day")
testStopHour = input(14, "Backtest Stop Hour")
testPeriodStop = timestamp(testStopYear,testStopMonth,testStopDay,testStopHour,0)
testPeriod() =>
time >= testPeriodStart and time <= testPeriodStop ? true : false
isPeriod = testPeriodSwitch == true ? testPeriod() : true
// === /END
if not isPeriod
strategy.cancel_all()
strategy.close_all()