xmd79

Trigrams

Sep 25th, 2021
304
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.72 KB | None | 0 0
  1. // This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
  2.  
  3. //@version=4
  4. study("Trigrams", overlay=true)
  5.  
  6. bullish = close > open
  7. bearish = close < open
  8.  
  9. body = abs(open-close)
  10. lowerShadow = min(open,close)-low
  11. upperShadow = high-max(close,open)
  12. range = high-low
  13.  
  14. ///Trigram Conditions
  15. /// Source: https://www.aguba.net/gupiao/10113.html
  16. Heaven = bearish and abs(high - open) < 0.2*body and abs(low - close) < 0.2*body
  17. Earth = bullish and abs(high - close) < 0.2*body and abs(low - open) < 0.2*body
  18. Water = bullish and upperShadow >= 1.5*body and upperShadow > 1.7 * lowerShadow
  19. Mountain = bullish and lowerShadow >= 1.5*body and lowerShadow > 1.7 * upperShadow
  20. Flame = bearish and lowerShadow >= 1.5*body and lowerShadow > 1.7 * upperShadow
  21. Lake = bearish and upperShadow >= 1.5*body and upperShadow > 1.7 * lowerShadow
  22.  
  23. Thunder = false
  24. Wind = false
  25. if (not Heaven and not Earth and not Water and not Mountain and not Flame and not Lake)
  26. Thunder := bearish and high > open and low < close
  27. Wind := bullish and high > close and low < open
  28.  
  29. ///Plot the Trigrams
  30. plotchar(Heaven, char='☰', location=location.abovebar, color=color.white)
  31. plotchar(Earth, char='☷', location=location.abovebar, color=color.black)
  32. plotchar(Thunder, char='☳', location=location.abovebar, color=color.yellow)
  33. plotchar(Water, char='☵' ,location=location.abovebar, color=color.aqua)
  34. plotchar(Mountain, char='☶', location=location.abovebar, color=color.maroon)
  35. plotchar(Wind, char='☴' ,location=location.abovebar, color=color.green)
  36. plotchar(Flame, char='☲' ,location=location.abovebar, color=color.red)
  37. plotchar(Lake, char='☱' ,location=location.abovebar, color=color.gray)
  38.  
Advertisement
Add Comment
Please, Sign In to add comment