xmd79

buying climax and selling climax

Oct 6th, 2021
342
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.57 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. // © Shauryam_or
  3. //@YaheeSweety is writer of Boring and Explosive Candles -
  4. //@version=5
  5. //Modified on 20180913
  6. //Defining Title and Name of Pine Script
  7. indicator('buying climax and selling climax', overlay=true)
  8.  
  9. rsi = ta.rsi(close, 14)
  10.  
  11. //-------------------------------------------------------------
  12. // Script for Explosive Candles
  13. // Part 1: taking user input
  14. // Part 2: Defining Variable and performing calculation
  15. // Part 3: giving BLUE color to candle based on calculation
  16. mp = input(2.0, title='Multiplier for Explo.Mov.')
  17. ratio = input(50, title='Range-Body Ratio for Explo.Mov.')
  18. cand = input(100, title='Average Number of Candles for Explo.Mov.')
  19.  
  20. range_1 = ta.atr(cand)
  21. candr = math.abs(high - low)
  22. bodyr = math.abs(open - close)
  23.  
  24. prev = math.abs(high[1] - low[1])
  25. nextabs = math.abs(high - low)
  26. explose = bodyr / candr >= ratio / 100 and candr >= range_1 * mp and volume > 2 * volume[3] and nextabs > 2 * prev
  27. barcolor(explose ? color.black : na, title='Explosive Move')
  28.  
  29. var line l1 = na
  30. var line l2 = na
  31.  
  32. price1 = high
  33. price2 = low
  34. dS1 = true
  35.  
  36. if explose
  37. l1 := line.new(bar_index[1], price1, bar_index, price1, color=color.red, style=line.style_solid, width=1, extend=dS1 ? extend.right : extend.both)
  38. l2 := line.new(bar_index[1], price2, bar_index, price2, color=color.green, style=line.style_solid, width=1, extend=dS1 ? extend.right : extend.both)
  39. line.delete(l1[1])
  40. line.delete(l2[1])
  41.  
  42.  
Advertisement
Add Comment
Please, Sign In to add comment