xmd79

Ultimate Oscillator [DM]

Jan 13th, 2022
451
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 22.95 KB | None | 0 0
  1. // @version=5
  2. //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ User Data Log ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~//
  3. // This indicator is modified or developed by [DM] D.Martinez
  4. // Copyright © D.Martinez 2020 to present
  5. // Title= xx.1 b.01 Ultimate Oscillator Trilogy >[DM]<
  6. // Release : SEP/08/2021 : First release on TDW
  7. // Update : SEP/08/2021 : na
  8. // Update : NOV/11/2021 : Update code to Pine v5, Added New Colors, Added BB
  9. // Original Autor: # Release Date: # Publication: #
  10. // Script may be freely distributed under the MIT license
  11. //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ User Inputs ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~//
  12. indicator(title="Ultimate Oscillator [DM]", shorttitle="UO [DM]", overlay=false)
  13.  
  14.  
  15. inp = input(close)
  16.  
  17.  
  18. /// Inputs ///
  19. inp_ctm_res = input.timeframe(defval="" , title="Resolution" , group="Source settings" )
  20. inp_opt_rep = input.bool (defval=true , title="Allow Repainting" , group="Source settings" )
  21. alrt_opt_01 = input (defval=false , title="Active Alerts " , group="Alerts settings" )
  22. inp_opt_sqz = input (defval=true , title="Active Squeeze Alerts" , group="Alerts settings" )
  23. inp_flen_sqz= input.float (defval=1.5,minval=000,maxval=5.0,step=0.01 , title="Squeeze Sensitivity" , group="Signal settings" )
  24. inp_col_cbar= input.bool (defval=false , title="Allow bar color condition" , group="Signal settings" )
  25. inp_col_fl1 = input.bool (defval=false , title="Fill Plots" , group="Signal settings" )
  26. inp_col_fl2 = input.bool (defval=false , title="Fill Bands" , group="Signal settings" )
  27. inp_col_bkg = input.bool (defval=true , title="Show BackGround" , group="Signal settings" )
  28. inp_sig_lvl = input.bool (defval=true , title="Show Reference Hlines" , group="Signal settings" )
  29. inp_col_lvl = input.bool (defval=true , title="Gradient Color Ob Os Lines?", group="Signal settings" )
  30. inp_opt_otp = input.string (defval="AVG", options = ["ALL","AVG","STD"] , title="Visualize Selected Signals" , group="Signal settings" )
  31. inp_ilen_11 = input.int (defval=00008, minval=00001, maxval=01595, step=00001, title="UO Fast Short Lenght" , group="UO #01 Lenght settings")
  32. inp_ilen_12 = input.int (defval=00032, minval=00002, maxval=01595, step=00001, title="UO Fast Long Length" , group="UO #01 Lenght settings")
  33. inp_ilen_21 = input.int (defval=00021, minval=00001, maxval=01595, step=00001, title="UO Mean Short Lenght" , group="UO #02 Lenght settings")
  34. inp_ilen_22 = input.int (defval=00144, minval=00002, maxval=01595, step=00001, title="UO Mean Long Length" , group="UO #02 Lenght settings")
  35. inp_ilen_31 = input.int (defval=00089, minval=00001, maxval=01595, step=00001, title="UO Slow Short Lenght" , group="UO #03 Lenght settings")
  36. inp_ilen_32 = input.int (defval=00233, minval=00002, maxval=01595, step=00001, title="UO Slow Long Length" , group="UO #03 Lenght settings")
  37. inp_haxs_ob = input.int (defval=00060, minval=0-100, maxval=10000, step=00001, title="OverBought Line" , group="Axis settings" )
  38. inp_haxs_os = input.int (defval=00040, minval=0-100, maxval=10000, step=00001, title="OverSell Line" , group="Axis settings" )
  39. inp_paxs_00 = input.float (defval=00050, minval=0-100, maxval=10000, step=000.1, title="Base Limit for plot" , group="Axis settings" )
  40. inp_sig_ofs = input.int (defval=00000, minval=00000, maxval=01595, step=00001, title="Offset Plot 01" , group="Source settings" )
  41. //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Source ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~//
  42. //~~~~~~~~~~~~~~~~~~~~~~~~ Security Function ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~//
  43. f_security(_symbol, _res, _src, _inp_opt_rep) =>
  44. request.security(_symbol, _res, _src[_inp_opt_rep ? 0 : barstate.isrealtime ? 1 : 0])[_inp_opt_rep ? 0 : barstate.isrealtime ? 0 : 1]
  45. src_hig = f_security(syminfo.tickerid, inp_ctm_res, high, inp_opt_rep)
  46. src_low = f_security(syminfo.tickerid, inp_ctm_res, low, inp_opt_rep)
  47. src_cls = f_security(syminfo.tickerid, inp_ctm_res, inp, inp_opt_rep)
  48. //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Brain ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~//
  49. fx_wuo(i_ilen_01,i_ilen_03,i_hig,i_low,i_cls)=>
  50. c_ilen_02 = math.round((i_ilen_01 + i_ilen_03) / 2)
  51. flen_mult = i_ilen_03 / i_ilen_01
  52. mlen_mult = i_ilen_03 / c_ilen_02
  53. cal_upbp = i_cls - math.min(i_low, i_cls[1])
  54. cal_uotr = math.max(i_hig, i_cls[1]) - math.min(i_low, i_cls[1])
  55. uo_avg_s = math.sum(cal_upbp, i_ilen_01) / math.sum(cal_uotr, i_ilen_01)
  56. uo_avg_m = math.sum(cal_upbp, c_ilen_02) / math.sum(cal_uotr, c_ilen_02)
  57. uo_avg_l = math.sum(cal_upbp, i_ilen_03) / math.sum(cal_uotr, i_ilen_03)
  58. wuosc = 100*( (uo_avg_s*flen_mult) + (uo_avg_m*mlen_mult) + (uo_avg_l*1) ) / (flen_mult+mlen_mult+1)
  59.  
  60. sig_wuo_01 = fx_wuo(inp_ilen_11, inp_ilen_12,src_hig, src_low, src_cls)
  61. sig_wuo_02 = fx_wuo(inp_ilen_21, inp_ilen_22,src_hig, src_low, src_cls)
  62. sig_wuo_03 = fx_wuo(inp_ilen_31, inp_ilen_32,src_hig, src_low, src_cls)
  63.  
  64. fx_wuo_mean(i_fslen,i_mslen,islen,i_flen_1,i_flen_2,i_mlen_1,i_mlen_2,i_slen_1,i_slen_2) =>
  65. cal_flen = math.avg(i_slen_1,i_slen_2) / math.avg(i_flen_1,i_flen_2)
  66. cal_mlen = math.avg(i_slen_1,i_slen_2) / math.avg(i_mlen_1,i_mlen_2)
  67. uoix_sig = ((i_fslen * cal_flen) + (i_mslen * cal_mlen) + islen) / (cal_flen + cal_mlen + 1)
  68. sig_wuo_0x = fx_wuo_mean(sig_wuo_01,sig_wuo_02,sig_wuo_03,inp_ilen_11,inp_ilen_12,inp_ilen_21,inp_ilen_22,inp_ilen_31,inp_ilen_32)
  69. //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ BB UO Function ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~//
  70. fx_bbwuo(inp_src,inp_flen_01)=>
  71. basis_sq = ta.sma (inp_src, 21)
  72. stdev_sq = ta.stdev(inp_src, 21)
  73. upper_sq = basis_sq + (stdev_sq * math.phi)
  74. lower_sq = basis_sq - (stdev_sq * math.phi)
  75. bbw_sq = 13 * ((upper_sq - lower_sq)/(upper_sq + lower_sq))
  76. squeeze = bbw_sq < inp_flen_01 ? true :na
  77. [squeeze]
  78. [otp_squeeze] = fx_bbwuo(sig_wuo_0x,inp_flen_sqz)
  79. //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Color Palette ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~//
  80. col_bkg_b1 = input.color(defval=color.rgb(000, 000, 000, 000), title="BackGround Black" , group="BackGround color") //confirm //inline
  81. col_hlvl_f1 = input.color(defval=color.rgb(005, 000, 255, 090), title="Color fill Levels", group="BackGround color") //confirm //inline
  82. col_sig_h01 = input.color(defval=color.rgb(125, 125, 125, 055), title="Hline color" , group="Hline color") //confirm //inline
  83. col_osob_00 = input.color(defval=color.rgb(200, 000, 000, 050), title="Hline color" , group="Hline color") //confirm //inline
  84. col_sig_x01 = input.color(color.new(#00ff8b ,000), title="Avg UO bull strong color" , group="Hline color") //bull_color
  85. col_sig_x02 = input.color(color.new(#00f3ff ,050), title="Avg UO bull weak color" , group="Hline color") //bull_color
  86. col_sig_x03 = input.color(color.new(#ff00b3 ,000), title="Avg UO bear strong color" , group="Hline color") //bear_color
  87. col_sig_x04 = input.color(color.new(#00f3ff ,050), title="Avg UO bear weak color" , group="Hline color") //bear_color
  88. col_sig_xh1 = input.color(color.new(#0aff00 ,000), title="Hline UO Avg bull strong color" , group="Hline color") //bull_color
  89. col_sig_xh2 = input.color(color.new(#00caff ,050), title="Hline UO Avg bull weak color" , group="Hline color") //bull_color
  90. col_sig_xh3 = input.color(color.new(#ff3500 ,000), title="Hline UO Avg bear strong color" , group="Hline color") //bear_color
  91. col_sig_xh4 = input.color(color.new(#ff7500 ,050), title="Hline UO Avg bear weak color" , group="Hline color") //bear_color
  92. col_sig_f01 = input.color(color.new(#00f6ff ,000), title="Fast UO bull strong color" , group="Hline color") //bull_color
  93. col_sig_f02 = input.color(color.new(#00ffde ,050), title="Fast UO bull weak color" , group="Hline color") //bull_color
  94. col_sig_f03 = input.color(color.new(#9f00ff ,000), title="Fast UO bear strong color" , group="Hline color") //bear_color
  95. col_sig_f04 = input.color(color.new(#2962ff ,050), title="Fast UO bear weak color" , group="Hline color") //bear_color
  96. col_sig_m01 = input.color(color.new(#f2ff00 ,000), title="Mean UO bull strong color" , group="Hline color") //bull_color
  97. col_sig_m02 = input.color(color.new(#ffcc00 ,050), title="Mean UO bull weak color" , group="Hline color") //bull_color
  98. col_sig_m03 = input.color(color.new(#ff8c00 ,000), title="Mean UO bear strong color" , group="Hline color") //bear_color
  99. col_sig_m04 = input.color(color.new(#ffb700 ,050), title="Mean UO bear weak color" , group="Hline color") //bear_color
  100. col_sig_s01 = input.color(color.new(#ff00f3 ,000), title="Slow UO bull strong color" , group="Hline color") //bull_color
  101. col_sig_s02 = input.color(color.new(#cb00ff ,050), title="Slow UO bull weak color" , group="Hline color") //bull_color
  102. col_sig_s03 = input.color(color.new(#a100ff ,000), title="Slow UO bear strong color" , group="Hline color") //bear_color
  103. col_sig_s04 = input.color(color.new(#b600ff ,050), title="Slow UO bear weak color" , group="Hline color") //bear_color
  104. //~~~~~~~~~~~~~~~~~~~~~~~~~~ Color Function ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~//
  105. fc_gradientRelativePro(_source, _min, _max, _c_bullStrong, _c_bullWeak, _c_bearStrong, _c_bearWeak) =>
  106. var float _center = _min + (_max - _min) / 2
  107. color _return = _source >= _center ?
  108. color.from_gradient(_source, _center, _max , _c_bullWeak , _c_bullStrong) :
  109. color.from_gradient(_source, _min , _center, _c_bearStrong, _c_bearWeak )
  110.  
  111. col_uos_xs = fc_gradientRelativePro(sig_wuo_0x, 035, 065, col_sig_x01, col_sig_x02, col_sig_x03, col_sig_x04)
  112. col_uos_hs = fc_gradientRelativePro(sig_wuo_0x, 035, 065, col_sig_xh1, col_sig_xh2, col_sig_xh3, col_sig_xh4)
  113. col_uos_fs = fc_gradientRelativePro(sig_wuo_01, 030, 070, col_sig_f01, col_sig_f02, col_sig_f03, col_sig_f04)
  114. col_uos_ms = fc_gradientRelativePro(sig_wuo_02, 035, 065, col_sig_m01, col_sig_m02, col_sig_m03, col_sig_m04)
  115. col_uos_ss = fc_gradientRelativePro(sig_wuo_03, 040, 060, col_sig_s01, col_sig_s02, col_sig_s03, col_sig_s04)
  116. col_os_ob = fc_gradientRelativePro(sig_wuo_0x, 035, 065, col_sig_x01, col_sig_x02, col_sig_x03, col_sig_x04)
  117. col_bkg_grd = otp_squeeze ? fc_gradientRelativePro(sig_wuo_0x, 035, 065, color.new(#0aff00 ,090), color.new(#00caff ,090), color.new(#ff3500 ,090), color.new(#ff7500 ,090)) : col_bkg_b1
  118. //~~~~~~~~~~~~~~~~~~~~~~~~~~ Color Condition ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~//
  119. osb_col_swh = inp_col_lvl ? col_uos_hs : col_osob_00
  120. col_bar_swh = inp_col_cbar ? col_uos_hs : na
  121. //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Signal Switch ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~//
  122. fx_switch_signal(inp_opt_otp, i_sig_wuo_0x, i_sig_wuo_01, i_sig_wuo_02, i_sig_wuo_03)=>
  123. wuo_0 = inp_opt_otp == "ALL" ? i_sig_wuo_0x : inp_opt_otp == "AVG" ? i_sig_wuo_0x : inp_opt_otp == "STD" ? na : 0.0
  124. wuo_f = inp_opt_otp == "ALL" ? i_sig_wuo_01 : inp_opt_otp == "AVG" ? na : inp_opt_otp == "STD" ? i_sig_wuo_01 : 0.0
  125. wuo_m = inp_opt_otp == "ALL" ? i_sig_wuo_02 : inp_opt_otp == "AVG" ? na : inp_opt_otp == "STD" ? i_sig_wuo_02 : 0.0
  126. wuo_s = inp_opt_otp == "ALL" ? i_sig_wuo_03 : inp_opt_otp == "AVG" ? na : inp_opt_otp == "STD" ? i_sig_wuo_03 : 0.0
  127. [wuo_0,wuo_f,wuo_m,wuo_s]
  128. [wuo_0,wuo_f,wuo_m,wuo_s] = fx_switch_signal(inp_opt_otp, sig_wuo_0x, sig_wuo_01, sig_wuo_02, sig_wuo_03)
  129. //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Plots ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~//
  130. plt_h0 = plot(series=50.0 , title="Ghost" , color= osb_col_swh, linewidth=1, style=plot.style_line, offset=inp_sig_ofs , editable=true, display=display.none)
  131. plt_sx = plot(series=wuo_0 , title="UO Avg Speed" , color= col_uos_xs , linewidth=1, style=plot.style_line, histbase=inp_paxs_00, offset=inp_sig_ofs, editable=true, display=display.all)
  132. plt_s1 = plot(series=wuo_f , title="UO Fast Speed", color= col_uos_fs , linewidth=1, style=plot.style_line, histbase=inp_paxs_00, offset=inp_sig_ofs, editable=true, display=display.all)
  133. plt_s2 = plot(series=wuo_m , title="UO Mean Speed", color= col_uos_ms , linewidth=1, style=plot.style_line, histbase=inp_paxs_00, offset=inp_sig_ofs, editable=true, display=display.all)
  134. plt_s3 = plot(series=wuo_s , title="UO Slow Speed", color= col_uos_ss , linewidth=1, style=plot.style_line, histbase=inp_paxs_00, offset=inp_sig_ofs, editable=true, display=display.all)
  135. plt_h2 = plot(series=inp_sig_lvl ? 50 : inp_haxs_ob, title="Over Bought" , color= osb_col_swh, linewidth=1, style=plot.style_line , offset=inp_sig_ofs, editable=true, display=display.all)
  136. plt_h1 = plot(series=inp_sig_lvl ? na : inp_haxs_os, title="Over Sell" , color= osb_col_swh, linewidth=1, style=plot.style_line , offset=inp_sig_ofs, editable=true, display=display.all)
  137. //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ H-Lines ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~//
  138. hline(price=inp_sig_lvl ? inp_haxs_ob :50 , color=inp_sig_lvl ? col_sig_h01 : na, linestyle=hline.style_dashed, linewidth=1, editable=true, title="Hline_01")
  139. hline(price=inp_sig_lvl ? 70 :50 , color=inp_sig_lvl ? col_sig_h01 : na, linestyle=hline.style_dashed, linewidth=1, editable=true, title="Hline_01")
  140. hline(price=inp_sig_lvl ? 30 :50 , color=inp_sig_lvl ? col_sig_h01 : na, linestyle=hline.style_dashed, linewidth=1, editable=true, title="Hline_01")
  141. hline(price=inp_sig_lvl ? inp_haxs_os :50 , color=inp_sig_lvl ? col_sig_h01 : na, linestyle=hline.style_dashed, linewidth=1, editable=true, title="Hline_01")
  142. //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Fill Plots ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~//
  143. fill(plot1=plt_h0, plot2=plt_sx, color=inp_col_fl1 ? (wuo_0 > 50.0 ? color.new(color.lime,090) : color.new(color.red,090)) : na, editable=false, fillgaps=true, title="Fill UO Average Signal")
  144. fill(plot1=plt_h0, plot2=plt_s3, color=inp_col_fl1 ? (wuo_s > 50.0 ? color.new(color.lime,090) : color.new(color.red,090)) : na, editable=false, fillgaps=true, title="Fill UO Fast Signal" )
  145. fill(plot1=plt_s3, plot2=plt_s2, color=inp_col_fl1 ? (wuo_m > wuo_s ? color.new(color.lime,090) : color.new(color.red,090)) : na, editable=false, fillgaps=true, title="Fill UO Medium Signal" )
  146. fill(plot1=plt_s2, plot2=plt_s1, color=inp_col_fl1 ? (wuo_f > wuo_m ? color.new(color.lime,090) : color.new(color.red,090)) : na, editable=false, fillgaps=true, title="Fill UO Slow Signal" )
  147. fill(plot1=plt_h2, plot2=plt_h1, color=inp_col_fl2 ? col_hlvl_f1 : na , editable=false, fillgaps=true, title="Fill H-Levels" )
  148. //~~~~~~~~~~~~~~~~~~~~~~~~~~~~ BackGround ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~//
  149. bgcolor(color=inp_col_bkg ? (inp_opt_sqz ? col_bkg_grd : col_bkg_b1) : na, offset=inp_sig_ofs , editable=true , title="Background Test_01" )
  150. //~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Bar color ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~//
  151. barcolor(color=col_bar_swh , offset=inp_sig_ofs , editable=false , title="Bar color" )
  152. //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Alerts ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~//
  153. //~~~~~~~~~~~~~~~~~~~~~~~~ Alert Conditions ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~//
  154. alrt_cnd_bull = ta.crossover (sig_wuo_0x, 50)
  155. alrt_cnd_bull_sqz = (otp_squeeze == true) and (sig_wuo_0x > 50) and (sig_wuo_0x > sig_wuo_0x[1])
  156. alrt_cnd_bear = ta.crossunder(sig_wuo_0x, 50)
  157. alrt_cnd_bear_sqz = (otp_squeeze == true) and (sig_wuo_0x < 50) and (sig_wuo_0x < sig_wuo_0x[1])
  158. //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Post ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~//
  159. if alrt_opt_01 and alrt_cnd_bull
  160. alert("Symbol = (" + syminfo.tickerid + ") TimeFrame = (" + timeframe.period + ") Current Price (" + str.tostring(close) + ") Williams Average Crossover Half Level.", alert.freq_once_per_bar_close)
  161. if alrt_opt_01 and alrt_cnd_bull_sqz
  162. alert("Symbol = (" + syminfo.tickerid + ") TimeFrame = (" + timeframe.period + ") Current Price (" + str.tostring(close) + ") Williams Average Crosses Have Squeeze Zone!!! And Is Over Half Level.", alert.freq_once_per_bar_close)
  163.  
  164. if alrt_opt_01 and alrt_cnd_bear
  165. alert("Symbol = (" + syminfo.tickerid + ") TimeFrame = (" + timeframe.period + ") Current Price (" + str.tostring(close) + ") Williams Average Crosses Crossunder Half Level.", alert.freq_once_per_bar_close)
  166. if alrt_opt_01 and alrt_cnd_bear_sqz
  167. alert("Symbol = (" + syminfo.tickerid + ") TimeFrame = (" + timeframe.period + ") Current Price (" + str.tostring(close) + ") Williams Average Have Squeeze Zone!!! And Is Under Half Level.", alert.freq_once_per_bar_close)
  168. //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ End Of The Code ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~//
  169. // NOTES:
  170. // 1.1 Before calculating the Ultimate Oscillator, two variable need to be defined; Buying Pressure and True Range.
  171. // Buying Pressure (BP) = Close - Minimum (Lowest between Current Low or Previous Close)
  172. // True Range (TR) = Maximum (Highest between Current High or Previous Close) - Minimum (Lowest between Current Low or Previous Close)
  173. // 1.2. The Ultimate Oscillator then uses these figures over three time periods:
  174. // Average7 = (7 Period BP Sum) / (7 Period TR Sum)
  175. // Average14 = (14 Period BP Sum) / (14 Period TR Sum)
  176. // Average28 = (28 Period BP Sum) / (28 Period TR Sum)
  177. // 1.3. The final Ultimate Oscillator calculations can now be made:
  178. // UO = 100 x [(4 x Average7)+(2 x Average14)+Average28]/(4+2+1)
  179. // 2. pi = 2 * asin(1)
  180. // 3. gauss= (34.13+34.13) + (13.59+13.59) + (2.14+2.14) + (0.13+0.13)
  181. // 4. time frames= ((365/7)*5)/12
  182. //
  183. ////////////////////////////////////////////////////////////////////////////////////////////////
  184. //----------------------------------------------------------------------0005UR1-DUD3LL40000---//
  185. //-----------------------------------------------------------------------00000000000000000----//
  186. //--------------'Y888888bo..-------:-----:-------..od888888Y'-------------012131815131210-----//
  187. //---8UTT3RFLY-----88JH0N8888b..----:----:----.d880LL1N63R8---------------012131815131210-----//
  188. //------5H4RK------88888Y'```Y8b.----'-'´---.d8Y'´´`Y888888---------------012131815131210-----//
  189. //-----CR48-------Y88888``.db.__.Yb.-¡'¡.'--.dY.´´.db.´8888Y--------------012131815131210-----//
  190. //---84T----------`888``Y88Y````8bd__(d)__bd88Y´´888´--8888---------------012131815131210-----//
  191. //--H4RM0N1C5-------888b``_' ````````(.)_´´´´´´'´´.d8888------------------012133815131210-----//
  192. //------------------Y88888bd8g.'`````(.)´´´´´.´´'.g8bd888Y----------------812131815131210-----//
  193. //---------------------'Y'88_.8.'JH0N-3LH3R5''8._.8._88'Y'----------------812131815131210-----//
  194. //--------------------.!__.8'_.db_.(.)':'..b.´8b8_'8.__!.-----------------812131815131210-----//
  195. //------------------------d88``'``.8_(.)_8.´´'´´88b__---------------------812131815131210-----//
  196. //----------------------d888b``.g8._.()._.8g.´´d888b_---------------------812131815131210-----//
  197. //---------------------:888888888Y'------'Y888888888:---------------------812131815131210-----//
  198. //---------------------'!_8888888´--------`8888888_!'---------------------812131815131210-----//
  199. //-----------------------'8Y--`'Y----------Y'´--Y8'-----------------------812131815131210-----//
  200. //----------------------'Y-----------------------Y'-----------------------812131815131210-----//
  201. //-----------------------------------------------------------------------00000000000000000----//
  202. //----------------------------------------------------------------------00000F180N4CC100000--0-//
  203. ////////////////////////////////////////////////////////////////////////////////////////////////
  204. ////8888888888----8888888------8888888--------\\1.618====\\\|///=============I=I====I=I=II==////
  205. ////88888888888---88888888----88888888--------//1.272====6=0=0=9============I===I==I=I=I=I==////
  206. ////8888----8888--8888-8888--8888-8888-------//1.000========!========I=====I=====II======I==////
  207. ////8888-----8888-8888--88888888--8888------//0.786========~~~======I=I===I==============II=////
  208. ////8888-----8888-8888---888888---8888-----//0.618=I====I==========I===I=I================I=////
  209. ////8888----8888--8888------------8888----//0.500===I==I=I=II=I===I=====I====3LL10T=W4V3==II////
  210. ////88888888888---8888------------8888---//0.382=====II===I==I=I=I==========================////
  211. ////8888888888----8888------------8888--//0.236=================I===========================////
  212. ////////////////////////////////////////////////////////////////////////////////////////////////
  213. //
  214. /// MIT License Terms https://opensource.org/licenses/mit-license.php ///
  215. //Permission is hereby granted, free of charge, to any person obtaining a copy of
  216. //this software and associated documentation files (the "Software"), to deal in
  217. //the Software without restriction, including without limitation the rights to
  218. //use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
  219. //of the Software, and to permit persons to whom the Software is furnished to do
  220. //so, subject to the following conditions:
  221. //
  222. //The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
  223. //
  224. //THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  225. //IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
  226. //FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
  227. //COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
  228. //IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  229. //CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  230. //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~//
Advertisement
Add Comment
Please, Sign In to add comment