Turtles Alerts

timchep · study · 42 行 · 点赞 305 · TradingView 原页

本页源码来自 TradingView 公开发布的开源脚本,版权归原作者所有, 请遵循其原始许可(Pine 脚本常见 CC BY-NC-SA / MPL-2.0 / MIT)。 本项目仅用于研究检索与许可范围内的移植。

Pine Script

//@version=2
//coded by tmr0, modified by timchep
//original idea from «Way of the Turtle: The Secret Methods that Turned Ordinary People into Legendary Traders» (2007) CURTIS FAITH
study("Turtles Alerts", shorttitle = "Turtles Alerts", overlay=true)
 
enter_fast = input(20, minval=1)
exit_fast = input(10, minval=1)
enter_slow = input(55, minval=1)
exit_slow = input(20, minval=1)
 
fastL = highest(enter_fast)
fastLC = lowest(exit_fast)
fastS = lowest(enter_fast)
fastSC = highest(exit_fast)
 
slowL = highest(enter_slow)
slowLC = lowest(exit_slow)
slowS = lowest(enter_slow)
slowSC = highest(exit_slow)
 
enterL1 = high > fastL[1]
exitL1 = low <= fastLC[1]
enterS1 = low < fastS[1]
exitS1 = high >= fastSC[1]
 
enterL2 = high > slowL[1]
exitL2 = low <= slowLC[1]
enterS2 = low < slowS[1]
exitS2 = high >= slowSC[1]
 
enterLong = enterL1 or enterL2
exitLong = exitL1 or exitL2
 
enterShort = enterS1 or enterS2
exitShort = exitS1 or exitS2
 
plotchar(enterL1, char="Enter L Fast", color = white)    
 
alertcondition(enterLong, title='Entry: Long', message="TT Entry: Long")
alertcondition(enterShort, title='Entry: Short', message='TT Entry: Short')
alertcondition(exitLong, title='Exit: Long', message='TT Exit: Long')
alertcondition(exitShort, title='Exit: Short', message='TT Exit: Short')

← 返回列表