该策略主要基于趋势突破原理,结合通道突破的方法,采用快线慢线双轨突破来判断趋势方向。策略同时具有突破 entries 和回撤 exits 双重保护,可以有效应对行情突变。策略最大的优势在于可以实时监测账户回撤,当回撤超过一定比例时,会主动降低持仓规模。这使得策略可以有效控制市场风险和账户抗风险能力。
快慢线双轨:分别采用快线和慢线构建通道。快线响应速度更快,慢线平滑程度更高。结合双轨突破判断趋势方向。
突破 entries:当价格突破向上通道时做多,突破向下通道时做空。采用止损单止损方式减小风险。
回撤 exits:实时监控最大回撤。一旦达到回撤退出点会主动止损平仓。回撤退出点可根据市场环境进行调整。
持仓规模自适应:持仓数量根据账户权益实时调整,规避市场风险。账户回撤越大,持仓越少。抗风险能力更强。
双轨通道+突破entries,判断趋势更准确。
止损止盈机制,有效控制单笔损失。
实时监控账户回撤,主动调整持仓规模,降低市场风险。
持仓规模与账户权益挂钩,抗风险能力强,可以应对行情突变。
大幅震荡行情中,回撤控制可能失效,导致亏损扩大。
快线进入中性区域时,可能出现多次无效突破信号。
慢线过于平滑,无法及时捕捉快速反转行情。
多空混合使用时,双向持仓存在套牢风险。
对于大幅震荡行情,可以设置更高的回撤容忍度,避免过度止损。
增加中性区域过滤,避免中性区域无效信号。
对慢线通道进行参数优化,提高对快速行情的响应速度。
添加开仓排序规则,避免双向持仓套牢。
该策略整体来说是一种适合中长线趋势交易的有效策略。策略最大的优势在于实时回撤监控和动态调整持仓。这使得策略可以自动调节仓位规模,具有很强的适应市场的能力。当出现大幅行情突变或价格震荡时,策略可以自动降低仓位规模,有效防止亏损扩大。这是很多传统策略难以做到的。整体来说,该策略的思路新颖,具有较强的实用性。值得探索和优化应用。
//Noro
//2020
//Original idea from «Way of the Turtle: The Secret Methods that Turned Ordinary People into Legendary Traders» (2007, CURTIS FAITH, ISBN: 9780071486644)
//@version=4
strategy("Noro's Turtles Strategy", shorttitle = "Turtles str", overlay = true, default_qty_type = strategy.percent_of_equity, initial_capital = 100, default_qty_value = 100, commission_value = 0.1)
//Settings
needlong = input(true, title = "Long")
needshort = input(false, title = "Short")
sizelong = input(100, defval = 100, minval = 1, maxval = 10000, title = "Lot long, %")
sizeshort = input(100, defval = 100, minval = 1, maxval = 10000, title = "Lot short, %")
needfast = input(true, title = "Fast")
needslow = input(true, title = "Slow")
enter_fast = input(20, minval=1)
exit_fast = input(10, minval=1)
enter_slow = input(55, minval=1)
exit_slow = input(20, minval=1)
showof = input(true, title = "Show offset")
showll = input(false, title = "Show lines")
showlabel = input(true, defval = true, title = "Show label")
fromyear = input(1900, defval = 1900, minval = 1900, maxval = 2100, title = "From Year")
toyear = input(2100, defval = 2100, minval = 1900, maxval = 2100, title = "To Year")
frommonth = input(01, defval = 01, minval = 01, maxval = 12, title = "From Month")
tomonth = input(12, defval = 12, minval = 01, maxval = 12, title = "To Month")
fromday = input(01, defval = 01, minval = 01, maxval = 31, title = "From day")
today = input(31, defval = 31, minval = 01, maxval = 31, title = "To day")
//Fast
fastL = highest(enter_fast)
fastLC = lowest(exit_fast)
fastS = lowest(enter_fast)
fastSC = highest(exit_fast)
//Slow
slowL = highest(enter_slow)
slowLC = lowest(exit_slow)
slowS = lowest(enter_slow)
slowSC = highest(exit_slow)
//Lines
offset = showof ? 1 : 0
col1 = showll and needlong and needfast ? color.blue : na
col2 = showll and needshort and needfast ? color.red : na
col3 = showll and needlong and needslow ? color.blue : na
col4 = showll and needshort and needslow ? color.red : na
plot(fastL, color = col1, offset = offset)
plot(fastLC, color = col1, offset = offset)
plot(fastS, color = col2, offset = offset)
plot(fastSC, color = col2, offset = offset)
plot(slowL, color = col3, offset = offset)
plot(slowLC, color = col3, offset = offset)
plot(slowS, color = col4, offset = offset)
plot(slowSC, color = col4, offset = offset)
//Orders
truetime = time > timestamp(fromyear, frommonth, fromday, 00, 00) and time < timestamp(toyear, tomonth, today, 23, 59)
size = strategy.position_size
lotlong = 0.0
lotlong := size != size[1] ? strategy.equity / close * sizelong / 100 : lotlong[1]
lotshort = 0.0
lotshort := size != size[1] ? strategy.equity / close * sizeshort / 100 : lotshort[1]
//Fast
strategy.entry("fast L", strategy.long, lotlong, stop = fastL, when = needfast and needlong and strategy.position_size == 0 and truetime)
strategy.entry("fast S", strategy.short, lotshort, stop = fastS, when = needfast and needshort and strategy.position_size == 0 and truetime)
strategy.exit("fast L", stop = fastLC, when = needfast and needlong and strategy.position_size > 0)
strategy.exit("fast S", stop = fastSC, when = needfast and needshort and strategy.position_size < 0)
//Slow
strategy.entry("slow L", strategy.long, lotlong, stop = slowL, when = needslow and needlong and strategy.position_size == 0 and truetime)
strategy.entry("slow S", strategy.short, lotshort, stop = slowS, when = needslow and needshort and strategy.position_size == 0 and truetime)
strategy.exit("slow L", stop = slowLC, when = needslow and needlong and strategy.position_size > 0)
strategy.exit("slow S", stop = slowSC, when = needslow and needshort and strategy.position_size < 0)
if time > timestamp(toyear, tomonth, today, 23, 59)
strategy.close_all()
strategy.cancel("fast L")
strategy.cancel("fast S")
strategy.cancel("slow L")
strategy.cancel("slow S")
if showlabel
//Drawdown
max = 0.0
max := max(strategy.equity, nz(max[1]))
dd = (strategy.equity / max - 1) * 100
min = 100.0
min := min(dd, nz(min[1]))
//Label
min := round(min * 100) / 100
labeltext = "Drawdown: " + tostring(min) + "%"
var label la = na
label.delete(la)
tc = min > -100 ? color.white : color.red
osx = timenow + round(change(time)*10)
osy = highest(100)