carloswm85

Untitled

Dec 8th, 2021
1,011
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // SET 4: Monthly
  2.  
  3.  
  4. // ------------------------------------------------------------------- Enablers
  5. enable_set4_high  = input.bool(defval=true, title='Set 4h', group='Set 4')
  6. enable_set4_low   = input.bool(defval=true, title='Set 4l', group='Set 4')
  7. enable_set4_fill   = input.bool(defval=true, title='Set 4 Fill', group='Set 4')
  8.  
  9.  
  10. // --------------------------------------------------------------------- Inputs
  11. set4_length   = input.int(defval=9, title='Length s4', group='Set 4')
  12. set4_offset   = input.int(defval=0, title='Offset s4', group='Set 4')
  13. // Resolutions
  14. set4_high_resolution = input.timeframe(title='Resolution s4h', defval='M', group='Set 4')
  15. set4_low_resolution = input.timeframe(title='Resolution s4l', defval='M', group='Set 4')
  16. // Fillers
  17. set4_high_filler_modifier = input.float(defval=7.0, title='Filler Modifier s4h (%)', group='Set 4')
  18. set4_low_filler_modifier = input.float(defval=7.0, title='Filler Modifier s4hl (%)', group='Set 4')
  19.  
  20.  
  21. // ----------------------------------------------------------------------- Security
  22. // Expressions
  23. set4_high_expression = ta.ema(high, set4_length)
  24. set4_low_expression = ta.ema(low, set4_length)
  25. // Get values using anti-repainting
  26. set4_high_sec = _nrp(set4_high_resolution, set4_high_expression) // core4 is high
  27. set4_low_sec = _nrp(set4_low_resolution, set4_low_expression) // core4 is low
  28.  
  29.  
  30. // -----------------------------------------------------------------------  Timeframe Disablers
  31. set4_timeframe_disable = timeframe.period == 'M' ? false : true
  32.  
  33.  
  34. // --------------------------------------------------------------------- Plotting
  35. // Colors
  36. set4_high_color = color.new(color_monthly, 50)
  37. set4_low_color = color.new(color_monthly, 50)
  38. set4_high_helper_color = color.new(color_monthly, 30)
  39. set4_low_helper_color = color.new(color_monthly, 30)
  40. set4_high_filler_color = color.new(color_monthly, 90)
  41. set4_low_filler_color = color.new(color_monthly, 90)
  42. // Visible Core
  43. set4_high_sec_plot = plot(enable_emac and enable_set4 and enable_set4_high and set4_timeframe_disable ? set4_high_sec : na, title='s4h', color=set4_high_color, linewidth=3, offset=set4_offset)
  44. set4_low_sec_plot = plot(enable_emac and enable_set4 and enable_set4_low and set4_timeframe_disable ? set4_low_sec : na, title='s4l', color=set4_low_color, linewidth=3, offset=set4_offset)
  45. // Non-visible Core
  46. set4_high_filler_modifier_calculated = set4_high_filler_modifier / 100
  47. set4_low_filler_modifier_calculated = set4_low_filler_modifier / 100
  48. set4_high_series = set4_high_sec + set4_high_sec * set4_high_filler_modifier_calculated
  49. set4_low_series = set4_low_sec + set4_low_sec * set4_low_filler_modifier_calculated
  50. set4_high_helper_plot = plot(enable_emac and enable_set4 and enable_set4_high and set4_timeframe_disable and enable_set4_fill ? set4_high_series : na, title='s4helper', color=dashed_color(set4_high_helper_color, high_gap), linewidth=1, offset=set4_offset)
  51. set4_low_helper_plot = plot(enable_emac and enable_set4 and enable_set4_low and set4_timeframe_disable and enable_set4_fill ? set4_low_series : na, title='s4lhelper', color=dashed_color(set4_low_helper_color, low_gap), linewidth=1, offset=set4_offset)
  52. // Fillers
  53. fill(plot1=set4_high_sec_plot, plot2=set4_high_helper_plot, color=set4_high_filler_color, title='Set 4h Fill')
  54. fill(plot1=set4_low_sec_plot, plot2=set4_low_helper_plot, color=set4_low_filler_color, title='Set 4l  Fill')
  55.  
RAW Paste Data