daily pastebin goal
81%
SHARE
TWEET

Untitled

dbayne May 16th, 2018 99 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //@version=3
  2. study(title="TtM - The Calculator", overlay=false)
  3.  
  4. //BEGIN General
  5.  
  6. BarCountForValueTotal = input(12, title="Bar Count for Value Total", minval=1)
  7. DownTrendTradeThreshold = input(3.25, title="Down Trend Trade Threshold", minval=0.00)
  8. UpTrendTradeThreshold = input(2.25, title="Up Trend Trade Threshold", minval=0.00)
  9. MainZero = input(0.00, title="Zero Base Line", minval=0.00)
  10.  
  11. //HigherLine=hline(DownTrendTradeThreshold, title="Down Trend Threshold Plot", color=green, linestyle=solid, linewidth=3)
  12. //LowerLine=hline(UpTrendTradeThreshold, title="Up Trend Threshold Plot", color=green, linestyle=dotted, linewidth=3)
  13. hline(MainZero, title="Zero Base Line Plot", color=red, linestyle=solid, linewidth=2)
  14.  
  15. //HigherLine=plot(DownTrendTradeThreshold, title="Down Trend Threshold Plot", color=green, style=line, linewidth=3)
  16. //LowerLine=plot(UpTrendTradeThreshold, title="Up Trend Threshold Plot", color=green, style=line, linewidth=3)
  17.  
  18. //END General
  19.  
  20.  
  21. //BEGIN Basic RSI
  22.  
  23. //Inputs
  24.     //Buy
  25. RSICrossUnderValue = input(1.00, title="RSI Cross Into Over Sold Value", minval=0.00)
  26. NormalRSIDivergenceValue = input(.5, title="Normal RSI Buy Divergence Value", minval=0.00)
  27.     //Sell
  28. RSICrossOverValue = input(1.00, title="RSI Cross Into Over Bought Value", minval=0.00)
  29. NormalRSIsellDivergenceValue = input(.5, title="Normal RSI Sell Divergence Value", minval=0.00)    
  30.  
  31. NormalRSILength = input(14, title="Normal RSI Length", minval=1)
  32. NormalRSIOverSoldEntry = input(30.00, title="Normal RSI Over Sold Entry", minval=0.00)
  33. NormalRSIOverBoughtEntry = input(70.00, title="Normal RSI Over Bought Entry", minval=0.00)
  34.  
  35. //Variables
  36. BasicRSI = rsi(close, NormalRSILength)
  37.  
  38. //For Plot
  39.     //Buy
  40. NormalRSIOverSoldCrossUnder = crossunder(BasicRSI, NormalRSIOverSoldEntry) ? RSICrossUnderValue : 0
  41. NormalRSIOverSoldDivergence = BasicRSI[1] < NormalRSIOverSoldEntry and BasicRSI[2] < NormalRSIOverSoldEntry and low < low[1] and low < low[2] and BasicRSI > BasicRSI[1] and BasicRSI > BasicRSI[2] ? NormalRSIDivergenceValue : 0
  42.     //Sell
  43. NormalRSIOverBoughtCrossOver = crossover(BasicRSI, NormalRSIOverBoughtEntry) ? RSICrossOverValue : 0
  44. NormalRSIOverBoughtDivergence = BasicRSI[1] > NormalRSIOverBoughtEntry and BasicRSI[2] > NormalRSIOverBoughtEntry and high > high[1] and high > high[2] and BasicRSI < BasicRSI[1] and BasicRSI < BasicRSI[2] ? NormalRSIsellDivergenceValue : 0
  45.  
  46. //END Basic RSI
  47.  
  48.  
  49.  
  50. //BEGIN Basic Stochastic
  51.  
  52. //Inputs
  53.     //Buy
  54. StochasticCrossUnderValue = input(1.00, title="Stochastic Cross Under Value", minval=0.00)
  55. StochasticKcrossDinOverSoldValue = input(.25, title="Stochastic K Ccoss D in Over Sold Value", minval=0.00)
  56.     //Sell
  57. StochasticCrossOverValue = input(1.00, title="Stochastic Cross Under Value", minval=0.00)
  58. StochasticKcrossDinOverBoughtValue = input(.25, title="Stochastic K Ccoss D in Over Sold Value", minval=0.00)
  59.  
  60. StochasticLength = input(10, title="Stochastic Length", minval=1)
  61. smoothK1 = input(3, title=" Stochastic K Line", minval=1)
  62. smoothD1 = input(3, title="Stochastic D line", minval=1)
  63. StochasticOSentry = input(20, title="Stochastic Over Sold Entry", minval=0.00)
  64. StochasticOBentry = input(80, title="Stochastic Over Sold Entry", minval=0.00)
  65.  
  66. //Variables
  67. k1 = sma(stoch(close, high, low, StochasticLength), smoothK1)
  68. d1 = sma(k1, smoothD1)
  69.  
  70. //For Plot
  71.     //Buy
  72. StochasticOverSoldCrossUnder = crossunder(k1, StochasticOSentry) ? StochasticCrossUnderValue : 0
  73. StochasticKcrossDinOverSold = crossover(k1, d1) and k1 < StochasticOSentry and d1 < StochasticOSentry ? StochasticKcrossDinOverSoldValue : 0
  74.     //Sell
  75. StochasticOverBoughtCrossOver = crossover(k1, StochasticOBentry) ? StochasticCrossOverValue : 0
  76. StochasticKcrossDinOverBought = crossunder(k1, d1) and k1 > StochasticOBentry and d1 > StochasticOBentry ? StochasticKcrossDinOverBoughtValue : 0
  77.  
  78. //END Basic Stochastic
  79.  
  80.  
  81.  
  82. //BEGIN MACD
  83.  
  84. //Inputs
  85.     //Buy
  86. MACDCrossOverValue = input(.25, title="MACD Cross Over Value", minval=0.00)
  87.     //Sell
  88. MACDCrossUnderValue = input(.25, title="MACD Cross Under Value", minval=0.00)
  89.  
  90. MACDCross = input(0.0, title="MACD Cross Over Reading", minval=0.0)
  91. MACDfastLength = input(12, title="MACD Fast")
  92. MACDslowlength = input(26, title="MACD Slow")
  93. MACDLength = input(9, title="MACD Length")
  94.  
  95. //Variables
  96. MACD = ema(close, MACDfastLength) - ema(close, MACDslowlength)
  97. aMACD = ema(MACD, MACDLength)
  98. delta = MACD - aMACD
  99.  
  100. //For Plot
  101.     //Buy
  102. MACDZeroCrossOver = crossover(delta, MACDCross) ? MACDCrossOverValue : 0
  103.     //Sell
  104. MACDZeroCrossUnder = crossunder(delta, MACDCross) ? MACDCrossUnderValue : 0
  105.  
  106. //END MACD
  107.  
  108.  
  109.  
  110. //BEGIN Momentum Divergence
  111.  
  112. //Inputs
  113.     //Buy
  114. BuyMomentumDivergenceValue = input(.25, title="Buy Momentum Divergence Value", minval=0.00)
  115. LowerBollingerBandBreachValue = input(.25, title="Lower Bollinger Band Breach Value", minval=0.00)
  116.     //Sell
  117. SellMomentumDivergenceValue = input(.25, title="Sell Momentum Divergence Value", minval=0.00)
  118. UpperBollingerBandBreachValue = input(.25, title="Upper Bollinger Band Breach Value", minval=0.00)
  119.  
  120. len = input(10, minval=1, title="Momentum Length")
  121. src = input(close, title="Momentum Source")
  122. bo=input(true,title="Use Bollinger Bands to Define Momentum Peaks")
  123. sb=input(true,"Show Vertical Lines for Momentum Divergence")
  124. l=input(30,"Momentum - High Low Look Back Period", minval=1)
  125.  
  126. //Variables
  127. mom = src - src[len]
  128. hh =highest(l),ll=lowest(l)
  129.  
  130. mh=highest(mom,l),ml=lowest(mom,l)
  131.  
  132. mwp=swma(close),mwm=swma(mom)
  133. coh=high>=hh?mom*1.15:na
  134. col=low<=ll?mom/0.85:na
  135. cmh=mom>=mh?mom:na
  136. cml=mom<=ml?mom:na
  137. dh=high>=hh  and mom<mh?1:0
  138. dl=low<=ll  and mom>ml ?1:0
  139. dhh=falling(mwm,3) or  change(mwm,3)<0
  140. dvh=dh and dhh?red:na
  141. dll=rising(mwm,3)  or change(mwm,3)>0
  142. dvl=dl and dll?lime:na
  143.  
  144. vvu=change(mwm,8)>0 and change(mwp,8)<0?mom:na
  145. vvd=change(mwm,8)<0 and change(mwp,8)>0?mom:na
  146.  
  147. hline(0)
  148. lengthb = input(20,title="Len BB", minval=1)
  149. srcb = mom
  150. mult = input(2.0,step=0.1, minval=0.001, maxval=50)
  151. basis = sma(srcb, lengthb)
  152. dev = mult * stdev(srcb, lengthb)
  153. upperb = basis + dev , lowerb = basis - dev
  154.  
  155. con=mom<lowerb or mom>upperb
  156. con1=con and con!=con[1]?mom:na
  157.  
  158. //For Plot
  159.     //Buy
  160. LowerBollingerBandBreach = con1 and mom < lowerb ? LowerBollingerBandBreachValue : 0
  161. BuyMomentumDivergence = dl and dll ? BuyMomentumDivergenceValue : 0
  162.     //Sell
  163. UpperBollingerBandBreach = con1 and mom > lowerb ? UpperBollingerBandBreachValue : 0
  164. SellMomentumDivergence = dh and dhh ? SellMomentumDivergenceValue : 0
  165.  
  166. //END Momentum Divergence
  167.  
  168.  
  169.  
  170. //BEGIN Nines with 13
  171.  
  172. // Inputs
  173.     //Buy
  174. DeMarkNineBuyValue = input(.25, title="DeMark Nine Buy Value", minval=0.00)
  175. DeMarkThirteenBuyValue = input(.25, title="DeMark Thirteen Buy Value", minval=0.00)
  176.     //Sell
  177. DeMarkNineSellValue = input(.25, title="DeMark Nine Sell Value", minval=0.00)
  178. DeMarkThirteenSellValue = input(.25, title="DeMark Thirteen Sell Value", minval=0.00)
  179.  
  180. Numbers=input(true, title="Nines Numbers")
  181.  
  182. // Variables
  183. TD = na
  184. TS = na
  185. TDUp = na
  186. TDDn = na
  187.  
  188. TD := close > close[4] ?nz(TD[1])+1:0
  189. TS := close < close[4] ?nz(TS[1])+1:0
  190. TDUp := TD - valuewhen(TD < TD[1], TD , 1 )
  191. TDDn := TS - valuewhen(TS < TS[1], TS , 1 )
  192.  
  193. // Sell Setup
  194. priceflip = barssince(close<close[4])
  195. sellsetup = close>close[4] and priceflip
  196. sell = sellsetup and barssince(priceflip!=9)
  197. sellovershoot = sellsetup and barssince(priceflip!=13)
  198.  
  199. // Buy setup
  200. priceflip1 = barssince(close>close[4])
  201. buysetup = close<close[4] and priceflip1
  202. buy = buysetup and barssince(priceflip1!=9)
  203. buyovershoot = barssince(priceflip1!=13) and buysetup
  204.  
  205. //For Plot
  206.     //Buy
  207. DeMarkNineBuy = TDDn==9 ? DeMarkNineBuyValue : 0
  208. DeMarkThirteenBuy = buyovershoot ? DeMarkThirteenBuyValue : 0
  209.     //Sell
  210. DeMarkNineSell = TDUp==9 ? DeMarkNineSellValue : 0
  211. DeMarkThirteenSell = sellovershoot ? DeMarkThirteenSellValue : 0
  212.  
  213.  
  214. //END Nines with 13
  215.  
  216.  
  217.  
  218. //BEGIN MFI
  219.  
  220. //Inputs
  221.     //Buy
  222. MFICrossUnderValue = input(.25, title="MFI Cross Under Buy Value", minval=0.00)
  223.     //Sell
  224. MFICrossOverValue = input(.25, title="MFI Cross Over Sell Value", minval=0.00)
  225.  
  226. MFIlength = input(title="MFI Length", type=integer, defval=14, minval=1, maxval=2000)
  227.  
  228. MFIOverSoldEntry = input(20, title="MFI Over Sold Entry", minval=0.00)
  229. MFIOverBoughtEntry = input(80, title="MFI Over Bought Entry", minval=0.00)
  230.  
  231. //Variables
  232. MFIsrc = hlc3
  233. upper = sum(volume * (change(MFIsrc) <= 0 ? 0 : src), MFIlength)
  234. lower = sum(volume * (change(MFIsrc) >= 0 ? 0 : src), MFIlength)
  235. mf = rsi(upper, lower)
  236.  
  237. //For Plot
  238.     //Buy
  239. MFICrossUnder = crossunder(mf, MFIOverSoldEntry) ? MFICrossUnderValue : 0
  240.     //Sell
  241. MFICrossOver = crossover(mf, MFIOverBoughtEntry) ? MFICrossOverValue : 0
  242.  
  243.  
  244. //END MFI
  245.  
  246.  
  247.  
  248. //BEGIN Buy-Sell Volume Pressure
  249.  
  250. //Inputs
  251.     //Buy
  252. VolumePressureBuyValue = input(.25, title="Volume Pressure Buy Value", minval=0.00)
  253.     //Sell
  254. VolumePressureSellValue = input(.25, title="Volume Pressure Sell Value", minval=0.00)
  255.  
  256. //Variables
  257. sp = high - close
  258. bp = close - low
  259. hline(0)
  260.  
  261. hullma(src, len) => wma(2*wma(src, len/2)-wma(src, len), round(sqrt(len)))
  262.  
  263. bpavg = hullma(bp,60)
  264. spavg = hullma(sp,60)
  265. nbp = bp/bpavg
  266. nsp = sp/spavg
  267. diff1 = nbp-nsp
  268. Varg = hullma(volume,60)
  269. nv = volume/Varg
  270. nbfraw = nbp * nv
  271. nsfraw = nsp * nv
  272.  
  273. //For Plot
  274.     //Buy
  275. VolumePressureBuy = nbfraw[5] < nsfraw[5] and nbfraw[4] < nsfraw[4] and nbfraw[3] < nsfraw[3] and nbfraw[2] < nsfraw[2] and nbfraw[1] > nsfraw[1] ? VolumePressureSellValue : 0
  276.     //Sell
  277. VolumePressureSell = nbfraw[5] > nsfraw[5] and nbfraw[4] > nsfraw[4] and nbfraw[3] > nsfraw[3] and nbfraw[2] > nsfraw[2] and nbfraw[1] < nsfraw[1] ? VolumePressureSellValue : 0
  278.  
  279. //END Buy-Sell Volume Pressure
  280.  
  281.  
  282.  
  283. //BEGIN Tops and Bottoms
  284.  
  285. //Inputs
  286.     //Buy
  287. BottomValue = input(.25, title="Bottom Value", minval=0.00)
  288.     //Sell
  289. TopValue = input(.25, title="Top Value", minval=0.00)
  290.  
  291. length2=input(3)
  292. bull=input(-.51, title="Bullish")
  293. bear=input(.43, title="Bearish")
  294.  
  295. //Variables
  296. ValC=sma(hl2, length2)
  297. vol=sma(atr(length2), length2)
  298.  
  299. cvi = (close-ValC) / (vol*sqrt(length2))
  300.  
  301. cb= cvi <= bull ? green : cvi >=bear ? red : cvi > bull ? blue : cvi < bear ? blue : na
  302. bull1 = cvi <= bull
  303. bear1 = cvi >= bear
  304. bull2 = bull1[1] and not bull1
  305. bear2 = bear1[1] and not bear1
  306.  
  307. //For Plot
  308.     //Buy
  309. Bottom = bull2 ? BottomValue : 0
  310.     //Sell
  311. Top = bear2 ? TopValue : 0
  312.  
  313. //END Tops and Bottoms
  314.  
  315.  
  316.  
  317. //BEGIN EMA
  318.  
  319. //Inputs
  320.     //Buy
  321. emaCrossOverValue = input(.25, title="EMA Cross Over Value", minval=0.00)
  322.     //Sell
  323. emaCrossUnderValue = input(.25, title="EMA Cross Under Value", minval=0.00)
  324.  
  325. ema1 = input(15, title="First EMA", minval=1)
  326. ema2 = input(50, title="Second EMA", minval=1)
  327.  
  328. //Variables
  329. firstEMA = ema(close, ema1)
  330. secondEMA = ema(close, ema2)
  331.  
  332. //Plots
  333.     //Buy
  334. emaCrossOver = crossover(firstEMA, secondEMA) ? emaCrossOverValue : 0
  335.     //Sell
  336. emaCrossUnder = crossunder(firstEMA, secondEMA) ? emaCrossUnderValue : 0
  337.  
  338. //END EMA
  339.  
  340.  
  341.  
  342. //BEGIN Ascending/Desending Highs and Lows
  343.  
  344. //Inputs
  345.     //Buy
  346. DescendingLowValue = input(.25, title="Descending Lows and Double Bottom Value", minval=0.00)    
  347.     //Sell
  348. AscendingLowValue = input(.25, title="Ascending Highs and Double Top Value", minval=0.00)
  349.    
  350. //Variables
  351.     //Buy
  352. DescendingLowCondition = low[5] >= low[4] and low[4] >= low[3] and low[3] >= low[2] and low[2] >= low[1] and low[1] < low
  353.     //Sell
  354. AscendingHighCondition = high[5] <= high[4] and high[4] <= high[3] and high[3] <= high[2] and high[2] <= high[1] and high[1] > high
  355.  
  356. //Plots
  357.     //Buy
  358. DescendingLows = DescendingLowCondition ? DescendingLowValue : 0
  359.     //Sell
  360. AscendingHighs = AscendingHighCondition ? AscendingLowValue : 0
  361.  
  362. //BEGIN Ascending/Desending Highs and Lows
  363.  
  364.  
  365.  
  366. //BEGIN Controller
  367.  
  368. //Inputs
  369. ControllerBuyCrossValue = input(1.00, title="Controller Buy Cross Value", minval=0.00)
  370.  
  371. zero = input(0.00, minval=0.00, title="Begin Caution Zone")
  372. UBL = input(5.00, minval=1.00, title="End Caution Zone")
  373.  
  374. //Variables
  375. src_fast = close, len_fast = input(5, minval=1, title="Length Fast RSI")
  376. src_slow = close, len_slow = input(14,minval=1, title="Length Slow RSI")
  377.  
  378. up_fast = rma(max(change(src_fast), 0), len_fast)
  379. down_fast = rma(-min(change(src_fast), 0), len_fast)
  380. rsi_fast = down_fast == 0 ? 100 : up_fast == 0 ? 0 : 100 - (100 / (1 + up_fast / down_fast))
  381. up_slow = rma(max(change(src_slow), 0), len_slow)
  382. down_slow = rma(-min(change(src_slow), 0), len_slow)
  383. rsi_slow = down_slow == 0 ? 100 : up_slow == 0 ? 0 : 100 - (100 / (1 + up_slow / down_slow))
  384.  
  385. divergence = rsi_fast - rsi_slow
  386.  
  387. band = hline(0, title="'0' Mid Line")
  388.  
  389. ControllerPlot =  divergence > zero ? lime : na
  390.  
  391. //For Plot
  392. ControllerBuyCross =  rsi_fast - rsi_slow ? ControllerBuyCrossValue : 0
  393. //The above string operates correctly. However it assumes the zero line from the main oscillator instead of the zero of the Controller itself.
  394. //Therefore it almopst always adds the value of the Controller to the score whether or not the Controller is over its own zero.
  395. //if you add this to the normal string on line 430, you will see what I mean: + highest(ControllerBuyCross, BarCountForValueTotal)
  396. //it most likely will add a value of 1 to all scores whether it should or not
  397. //if you load the indicator as is and then another one with the above addition. you should be able to see the differences.
  398. //right now this doesn't show up as a value at all. It shows up as a green background and then I manually add its value to the score to get my overall score.
  399. //That is why I went for the next string. I just take the normal value of the Controller off the calculations and look for the net value to be in the green zone.
  400. //So, instead of say 4.25 as an overall score, it's 3.25 in the green zone.
  401. bgcolor(ControllerPlot, title="The Controller Back Ground Color", transp=(75))
  402.  
  403. //END Controller
  404.  
  405.  
  406.  
  407. //BEGIN Pivot
  408. //I know this Pivot code does not actually plot. The only reason it is here is for calculations for adding fill between 2.25 and 3.25.
  409. //I actually have this snippet in another indicator as well. That is where it actually plots.
  410.  
  411. //@version=3
  412. //study("Pivots", overlay=true)
  413. //Pivot High
  414. leftBars = input(10, title="Pivot High - 10 Left")
  415. rightBars = input(10, title="Pivot High - 10 Right")
  416. ph = pivothigh(leftBars, rightBars)
  417.             //plot(ph, title="Pivot High - 10",  style=cross, linewidth=5, color= red, offset=-rightBars)
  418. // good but don't need     plotshape(ph, title="Pivot High - 10", style=shape.labeldown, color= black, location=location.abovebar, size=size.normal, offset=-rightBars, text="PIVOT HIGH", textcolor=white, transp=(100))
  419. plotchar(ph, title="Pivot High Location", char="|", color=black, location=location.abovebar, size=size.huge, transp=40, offset=-10)
  420.  
  421. //Pivot Low
  422. // good but don't need     pl = pivotlow(close, leftBars, rightBars)
  423. // good but don't need     plotshape(pl, title="Pivot Low - 10", style=shape.labelup, color= black, location=location.belowbar, size=size.normal, offset=-rightBars, text="PIVOT LOW", textcolor=white, transp=(100))
  424.  
  425. //END Pivots
  426.  
  427.  
  428. //BEGIN General
  429.     //Buy
  430. BuyScore = highest(NormalRSIOverSoldCrossUnder, BarCountForValueTotal) + highest(NormalRSIOverSoldDivergence, BarCountForValueTotal) + highest(StochasticOverSoldCrossUnder, BarCountForValueTotal) + highest(StochasticKcrossDinOverSold, BarCountForValueTotal) + highest(MACDZeroCrossOver, BarCountForValueTotal) + highest(LowerBollingerBandBreach, BarCountForValueTotal) + highest(BuyMomentumDivergence, BarCountForValueTotal) + highest(DeMarkNineBuy, BarCountForValueTotal) + highest(DeMarkThirteenBuy, BarCountForValueTotal) + highest(MFICrossUnder, BarCountForValueTotal) + highest(VolumePressureBuy, BarCountForValueTotal) + highest(Bottom, BarCountForValueTotal) + highest(emaCrossOver, BarCountForValueTotal) + highest(DescendingLows, BarCountForValueTotal)
  431. plot(BuyScore, title="Total Buy Value Plot Line", color=blue, style=stepline, linewidth=3, transp=0)
  432.     //Sell
  433. SellScore = highest(NormalRSIOverBoughtCrossOver, BarCountForValueTotal) + highest(NormalRSIOverBoughtDivergence, BarCountForValueTotal) + highest(StochasticOverBoughtCrossOver, BarCountForValueTotal) + highest(StochasticKcrossDinOverBought, BarCountForValueTotal) + highest(MACDZeroCrossUnder, BarCountForValueTotal) + highest(UpperBollingerBandBreach, BarCountForValueTotal) + highest(SellMomentumDivergence, BarCountForValueTotal) + highest(DeMarkNineSell, BarCountForValueTotal) + highest(DeMarkThirteenSell, BarCountForValueTotal) + highest(MFICrossOver, BarCountForValueTotal) + highest(VolumePressureSell, BarCountForValueTotal) + highest(Top, BarCountForValueTotal) + highest(emaCrossUnder, BarCountForValueTotal) + highest(AscendingHighs, BarCountForValueTotal)
  434. plot(SellScore, title="Total Sell Value Plot Line", color=red, style=stepline, linewidth=1, transp=0)  
  435.    
  436.     //Bar Color
  437. BarColorDownTrendThreshold = input(3.25, title="Bar Color Down Trend Threshold", minval=0.00)
  438. BarColorDownTrendCondition = BuyScore >= BarColorDownTrendThreshold and divergence > zero
  439.     //GOOD, but did not include Controller    barcolor(BuyScore >= BarColorDownTrendThreshold ? lime : na)
  440. barcolor(BarColorDownTrendCondition ? lime : na)
  441.  
  442. BarColorUpTrendThreshold = input(2.25, title="Bar Color Up Trend Threshold", minval=0.00)
  443. BarColorUpTrendCondition = BuyScore >= BarColorUpTrendThreshold and divergence > zero
  444.     //GOOD, but did not include Controller    barcolor(BuyScore >= BarColorUpTrendThreshold ? #00ffff : na)
  445. barcolor(BarColorUpTrendCondition ? #00ffff : na)
  446.  
  447. //Market Bias
  448.     //Buy
  449. UpTrend = close[120] < close[96] and close[96] < close[72] and close[72] < close[48] and close[48] < close[24] and close[24] < close
  450. plotchar(UpTrend, title="Up Trend Bias", char="⇡", color=blue, size=size.small, location=location.abovebar, transp=(60))
  451.     //Sell
  452. DownTrend = close[120] > close[96] and close[96] > close[72] and close[72] > close[48] and close[48] > close[24] and close[24] > close
  453. plotchar(DownTrend, title="Down Trend Bias", char="⇣", color=red, size=size.small, location=location.abovebar, transp=(60))
  454.  
  455. //END General
  456.  
  457.  
  458.  
  459. //BEGIN Fill Coding
  460.  
  461. FirstClusterCondition = BuyScore >= 2.25 and divergence > zero and BuyScore < 3.25
  462. //plotshape(FirstClusterCondition,shape=shape.triangleup,color=blue,size=size.normal,location=location.abovebar, transp=0)
  463. plotshape(FirstClusterCondition, title="", style=shape.triangleup, size=size.tiny, color=green, transp=20, location=location.abovebar)
  464. //bgcolor(FirstClusterCondition, title="", color=red, transp=0)
  465. //fill(LowerLine, HigherLine, color=red, transp=80)
  466.  
  467. //barssince(ph) <= 50
  468. //barssince(ph <= 5) and
  469.  
  470. //PartialFillArea = BuyScore > LowerLine and BuyScore < HigherLine ? yellow : na
  471. //fill(HigherLine,LowerLine, color=PartialFillArea)
  472.  
  473. //HighlightColor1 = input(color=red)
  474.  
  475.  
  476. //PREVIOUSLY GOOD
  477. //HigherLine=hline(DownTrendTradeThreshold, title="Down Trend Threshold Plot", color=green, linestyle=solid, linewidth=3)
  478. //LowerLine=hline(UpTrendTradeThreshold, title="Up Trend Threshold Plot", color=green, linestyle=dotted, linewidth=3)
  479.  
  480.  
  481. PartialFillCondition = BuyScore >= UpTrendTradeThreshold and divergence > zero
  482. //PartialFillConditionOffset= PartialFillCondition[1]
  483.  
  484. HigherLine=plot(DownTrendTradeThreshold, title="Down Trend Threshold Plot", color=green, linewidth=3, style=line)
  485. LowerLine=plot(UpTrendTradeThreshold, title="Up Trend Threshold Plot", color=purple, linewidth=3, style=line)
  486.  
  487. //p4=plot(BuyScore, color=lime, linewidth=3)
  488.  
  489. //hline(DownTrendTradeThreshold, color=white, linewidth=3)
  490.  
  491. //fill(HigherLine,LowerLine,color=BuyScore>=UpTrendTradeThreshold?yellow:white, transp=30)
  492.  
  493. fill(HigherLine,LowerLine,color=PartialFillCondition?yellow:#00000000, transp=50)
  494.  
  495. //End Fill Coding
  496.  
  497.  
  498.  
  499. //Alerts
  500.  
  501. LowerLevelThresholdMet = BuyScore >= 2.25 and divergence > zero and SellScore <= 1.00 and barssince(UpTrend) <= 24
  502. plotshape(LowerLevelThresholdMet, title="Lower Level Threshold Met ", style=shape.square, size=size.tiny, color=black, transp=(0), location=location.abovebar)
  503.  
  504. UpperLevelThresholdMet = BuyScore >= 3.25 and divergence > zero and SellScore <= 1.50
  505. plotshape(UpperLevelThresholdMet, title="Upper Level Threshold Met ", style=shape.circle, size=size.tiny, color=red, transp=(0), location=location.abovebar)
  506.  
  507.  
  508. alertcondition(LowerLevelThresholdMet, "alert1", "alert2")
  509. alertcondition(UpperLevelThresholdMet, "alert3", "alert4")
  510.  
  511. //LowAlertValue = input(2.25)
  512. //HighAlertValue = input(3.25)
  513.  
  514. //LowAlertCondition = input(2.25)
  515. //HighAlertCondition = input(3.25)
  516.  
  517. //LowAlert = LowAlertCondition ? LowAlertValue : 0
  518. //HighAlert = HighAlertCondition ? HighAlertValue : 0
  519.  
  520. //plot(LowAlert, color=orange, linewidth=1, transp=100)
  521. //plot(HighAlert, color=orange, linewidth=1, transp=100)
  522.  
  523. //alertcondition(LowAlert, "LowAlert", "LowAlertValue Breach")
  524. //alertcondition(HighAlert, "High Alert", "HighAlertValue Breach")
  525.  
  526.     //alertcondition((BuyScore >= 1.25), "alert1", "2.25 Breach")
  527.           //alertcondition((score >= 1.25), "alert1", "alert2")
  528.          //alertcondition(crossover(score, 3.25), "alert", "alert")
  529.  
  530. //END Alerts
RAW Paste Data
Top