// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © ZenAndTheArtOfTrading
// @version=4
study("PSMC - Hammer & Shooting Stars", overlay=true)
// Get user input
fibLevel = input(title="Fib Level", type=input.float, defval=0.333)
colorFilter = input(title="Color Must Match", type=input.bool, defval=false)
// Calculate fibonacci level for current candle
bullFib = (low - high) * fibLevel + high
bearFib = (high - low) * fibLevel + low
// Determine which price source closes or opens highest/lowest
lowestBody = close < open ? close : open
highestBody = close > open ? close : open
// Determine if we have a valid hammer or shooting star
hammerCandle = lowestBody >= bullFib and (not colorFilter or close > open)
starCandle = highestBody <= bearFib and (not colorFilter or close < open)
// Plot the signals to the chart
plotshape(hammerCandle, style=shape.arrowup, location=location.belowbar, color=color.green)
plotshape(starCandle, style=shape.arrowdown, location=location.abovebar, color=color.red)
// Trigger alerts
alertcondition(hammerCandle or starCandle, title="Hammer or Shooting Star Alert", message="{{ticker}}")
2021年1月25日 星期一
TradingView 找出K線的錘頭線及射擊之星
訂閱:
張貼留言 (Atom)
沒有留言:
張貼留言