Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
- //@version=4
- study("Trigrams", overlay=true)
- bullish = close > open
- bearish = close < open
- body = abs(open-close)
- lowerShadow = min(open,close)-low
- upperShadow = high-max(close,open)
- range = high-low
- ///Trigram Conditions
- /// Source: https://www.aguba.net/gupiao/10113.html
- Heaven = bearish and abs(high - open) < 0.2*body and abs(low - close) < 0.2*body
- Earth = bullish and abs(high - close) < 0.2*body and abs(low - open) < 0.2*body
- Water = bullish and upperShadow >= 1.5*body and upperShadow > 1.7 * lowerShadow
- Mountain = bullish and lowerShadow >= 1.5*body and lowerShadow > 1.7 * upperShadow
- Flame = bearish and lowerShadow >= 1.5*body and lowerShadow > 1.7 * upperShadow
- Lake = bearish and upperShadow >= 1.5*body and upperShadow > 1.7 * lowerShadow
- Thunder = false
- Wind = false
- if (not Heaven and not Earth and not Water and not Mountain and not Flame and not Lake)
- Thunder := bearish and high > open and low < close
- Wind := bullish and high > close and low < open
- ///Plot the Trigrams
- plotchar(Heaven, char='☰', location=location.abovebar, color=color.white)
- plotchar(Earth, char='☷', location=location.abovebar, color=color.black)
- plotchar(Thunder, char='☳', location=location.abovebar, color=color.yellow)
- plotchar(Water, char='☵' ,location=location.abovebar, color=color.aqua)
- plotchar(Mountain, char='☶', location=location.abovebar, color=color.maroon)
- plotchar(Wind, char='☴' ,location=location.abovebar, color=color.green)
- plotchar(Flame, char='☲' ,location=location.abovebar, color=color.red)
- plotchar(Lake, char='☱' ,location=location.abovebar, color=color.gray)
Advertisement
Add Comment
Please, Sign In to add comment