fork download
  1. -----------------------------------------------------------------
  2. ---- "UPGRADE CDST v3.0 FULL VERSION ----------------------------
  3. ---- CREATE BY "KITTITAT WASATI" --------------------------------
  4. ---- Youtube: https://w...content-available-to-author-only...e.com/c/KittitatWasati ----------
  5. -----------------------------------------------------------------
  6. ---- Hello all from THAILAND! -----------------------------------
  7. ---- This Indicator make for trading binary option --------------
  8. ---- It is suitable for beginners and make begin to trader ------
  9. ---- This is not financial advice -------------------------------
  10. ---- keep calm and stay cool ------------------------------------
  11. instrument { name = "UCDST v3 FULL",
  12. icon="indicators:MACD",
  13. overlay = true
  14. }
  15. -- EMA setting --
  16. e5 = input (5, "fastMa", input.integer, 3,250,1)
  17. e15 = input (15, "slowMa", input.integer, 3,250,1)
  18. e30 = input (30, "middleMA", input.integer, 3,250,1)
  19. e60 = input (60, "trendMA", input.integer, 3,250,1)
  20. s5 = input (5, "SMA", input.integer, 1,250,1)
  21. ------ input group ------
  22. -- Line & Fill --
  23. input_group {
  24. "Line & Fill",
  25. color1 = input { default = "#26a8ff", type = input.color },
  26. color2 = input { default = "#ffff01", type = input.color },
  27. color3 = input { default = "#ffffff", type = input.color },
  28. color4 = input { default = "#ff0101", type = input.color },
  29. width = input { default = 1, type = input.line_width},
  30. fill_a_color = input { default = rgba(255,88,77,0.15), type = input.color },
  31. fill_b_color = input { default = rgba(43,225,135,0.15), type = input.color },
  32. fill_c_color = input { default = rgba(38,168,255,0.15), type = input.color },
  33. visible = input { default = false, type = input.plot_visibility }
  34. }
  35. -- Arrow --
  36. input_group {
  37. "Color Arrow",
  38. colorBuy = input { default = "#08FE0B", type = input.color },
  39. colorSell = input { default = "#FF0909", type = input.color },
  40. width = input { default = true, type = input.line_width}
  41. }
  42. -- b1 Signal --
  43. input_group {
  44. "B1 SIGNAL (1 MINUTE TRADING)",
  45. b1_visible = input { default = false, type = input.plot_visibility }
  46. }
  47. input_group {
  48. "B2 SIGNAL (2 MINUTE TRADING)",
  49. b2_visible = input { default = false, type = input.plot_visibility }
  50. }
  51. input_group {
  52. "B3 SIGNAL (3 MINUTE TRADING)",
  53. b3_visible = input { default = false, type = input.plot_visibility }
  54. }
  55. input_group {
  56. "B4 SIGNAL (4 MINUTE TRADING)",
  57. b4_visible = input { default = false, type = input.plot_visibility }
  58. }
  59. input_group {
  60. "B5 SIGNAL (5 MINUTE TRADING)",
  61. b5_visible = input { default = false, type = input.plot_visibility }
  62. }
  63. -- color of sma5 --
  64. input_group {
  65. "SMA5",
  66. color5 = input { default = "#26a8ff", type = input.color },
  67. width2 = input { default = 1, type = input.line_width },
  68. sma5_visible = input { default = false, type = input.plot_visibility }
  69. }
  70. -- backtester --
  71. input_group {
  72. "--- BACKTESTER B1",
  73. b1check_visible = input { default = true, type = input.plot_visibility }
  74. }
  75. input_group {
  76. "--- BACKTESTER B1 REJECTION",
  77. b1rejectioncheck_visible = input { default = false, type = input.plot_visibility }
  78. }
  79. input_group {
  80. "-- BACKTESTER B2",
  81. b2check_visible = input { default = true, type = input.plot_visibility }
  82. }
  83. input_group {
  84. "-- BACKTESTER B3",
  85. b3check_visible = input { default = true, type = input.plot_visibility }
  86. }
  87. input_group {
  88. "-- BACKTESTER B4",
  89. b4check_visible = input { default = true, type = input.plot_visibility }
  90. }
  91. input_group {
  92. "-- BACKTESTER B5",
  93. b5check_visible = input { default = true, type = input.plot_visibility }
  94. }
  95. -- plot --
  96. ema5 = ema (close, e5)
  97. ema15 = ema (close, e15)
  98. ema30 = ema (close, e30)
  99. ema60 = ema (close, e60)
  100. sma5 = sma (close, s5)
  101. ema200 = ema(close, 200)
  102. if sma5_visible then
  103. plot (sma5, "SMA5", color5, width2)
  104. if visible then
  105. plot (ema5, "EMA5", color1, width)
  106. plot (ema15, "EMA15", color2, width)
  107. plot (ema30, "EMA30", color3, width)
  108. fill (ema15, ema5, "", ema15 > ema5 and fill_b_color or fill_a_color)
  109. fill (ema15, ema30, "", ema15 > ema30 and fill_b_color or fill_a_color)
  110. fill (ema30, ema60, "", ema60 > ema30 and fill_c_color or fill_c_color)
  111. -- B1 Condition --
  112. b1candle4buy = close[1] < ema5[1] and
  113. close[2] < ema5[2] and
  114. close[3] < ema5[3] and
  115. close[4] < ema5[4] and
  116. open[1] < ema5[1] and
  117. open[2] < ema5[2] and
  118. open[3] < ema5[3] and
  119. open[4] < ema5[4]
  120. b1candle4sell = close[1] > ema5[1] and
  121. close[2] > ema5[2] and
  122. close[3] > ema5[3] and
  123. close[4] > ema5[4] and
  124. open[1] > ema5[1] and
  125. open[2] > ema5[2] and
  126. open[3] > ema5[3] and
  127. open[4] > ema5[4]
  128. bigcandlebuy = abs(open-close) > abs(high-close)*3
  129. bigcandlesell = abs(open-close) > abs(low-close)*3
  130. bigcandle = abs(close-open) > abs(close[1]-open[1]) and
  131. abs(close-open) > abs(close[2]-open[2]) and
  132. abs(close-open) > abs(close[3]-open[3]) and
  133. abs(close-open) > abs(close[4]-open[4])
  134. b1buycon = open < ema5 and
  135. close > ema5 and
  136. b1candle4buy and
  137. bigcandlebuy and
  138. bigcandle and
  139. close < ema15 and
  140. high < ema15 and
  141. ema15 > ema5 and
  142. ema30 > ema15
  143. b1sellcon = open > ema5 and
  144. close < ema5 and
  145. b1candle4sell and
  146. bigcandlesell and
  147. bigcandle and
  148. close > ema15 and
  149. low > ema15 and
  150. ema15 < ema5 and
  151. ema30 < ema15
  152. -- end of B1 Condition --
  153.  
  154. if b1_visible then
  155. -- B1 Buy --
  156. plot_shape(b1buycon,
  157. "B1_Buy",
  158. shape_style.arrowup,
  159. shape_size.auto,
  160. colorBuy,
  161. shape_location.belowbar,
  162. 0,
  163. "B1",
  164. colorBuy
  165. )
  166. -- B1 Sell --
  167. plot_shape(b1sellcon,
  168. "B1_Sell",
  169. shape_style.arrowdown,
  170. shape_size.auto,
  171. colorSell,
  172. shape_location.abovebar,
  173. 0,
  174. "B1",
  175. colorSell
  176. )
  177. b2candle4buy = close[1] < ema15[1] and
  178. close[2] < ema15[2] and
  179. close[3] < ema15[3] and
  180. close[4] < ema15[4] and
  181. open[1] < ema15[1] and
  182. open[2] < ema15[2] and
  183. open[3] < ema15[3] and
  184. open[4] < ema15[4] and
  185. abs(open-close) > abs(high-close)*3
  186. b2candle4sell = close[1] > ema15[1] and
  187. close[2] > ema15[2] and
  188. close[3] > ema15[3] and
  189. close[4] > ema15[4] and
  190. open[1] > ema15[1] and
  191. open[2] > ema15[2] and
  192. open[3] > ema15[3] and
  193. open[4] > ema15[4] and
  194. abs(open-close) > abs(low-close)*3
  195. b2bigcandle = abs(close-open) > abs(close[1]-open[1]) and
  196. abs(close-open) > abs(close[2]-open[2]) and
  197. abs(close-open) > abs(close[3]-open[3]) and
  198. abs(close-open) > abs(close[4]-open[4])
  199. b2bigcandlebuy = close > high[1] and
  200. close > high[2] and
  201. close > high[3] and
  202. close > high[4]
  203. b2bigcandlesell = close < low[1] and
  204. close < low[2] and
  205. close < low[3] and
  206. close < low[4]
  207. b2buycon = open < ema15 and
  208. close > ema15 and
  209. b2candle4buy and
  210. b2bigcandle and
  211. b2bigcandlebuy and
  212. high < ema30 and
  213. ema60 > ema30 and
  214. ema30 > ema15 and
  215. ema15 > ema5
  216. b2sellcon = open > ema15 and
  217. close < ema15 and
  218. b2candle4sell and
  219. b2bigcandle and
  220. b2bigcandlesell and
  221. low > ema30 and
  222. ema60 < ema30 and
  223. ema30 < ema15 and
  224. ema15 < ema5
  225. -- B2 Buy --
  226. plot_shape(b2buycon,
  227. "B2_Buy",
  228. shape_style.arrowup,
  229. shape_size.auto,
  230. colorBuy,
  231. shape_location.belowbar,
  232. 0,
  233. "B2",
  234. colorBuy
  235. )
  236. -- B2 Sell --
  237. plot_shape(b2sellcon,
  238. "B2_Sell",
  239. shape_style.arrowdown,
  240. shape_size.auto,
  241. colorSell,
  242. shape_location.abovebar,
  243. 0,
  244. "B2",
  245. colorSell
  246. )
  247. b3candlebuy = high[1] < ema30[1] and
  248. high[2] < ema30[2] and
  249. high[3] < ema30[3] and
  250. high[4] < ema30[4] and
  251. high[5] < ema30[5]
  252. b3candlesell = low[1] > ema30[1] and
  253. low[2] > ema30[2] and
  254. low[3] > ema30[3] and
  255. low[4] > ema30[4] and
  256. low[5] > ema30[5]
  257. b3xcrossbuy = ema5[1] < ema15[1] and
  258. ema5[2] < ema15[2] and
  259. ema5[3] < ema15[3] and
  260. ema5[4] < ema15[4] and
  261. ema5[5] < ema15[5]
  262. b3xcrosssell = ema5[1] > ema15[1] and
  263. ema5[2] > ema15[2] and
  264. ema5[3] > ema15[3] and
  265. ema5[4] > ema15[4] and
  266. ema5[5] > ema15[5]
  267. b3bigcandle = abs(close-open) > abs(close[1]-open[1]) and
  268. abs(close-open) > abs(close[2]-open[2]) and
  269. abs(close-open) > abs(close[3]-open[3]) and
  270. abs(close-open) > abs(close[4]-open[4])
  271. b3trendbuy = ema30 > ema15 and
  272. ema30[1] > ema15[1] and
  273. ema30[2] > ema15[2] and
  274. ema30[3] > ema15[3] and
  275. ema30[4] > ema15[4] and
  276. ema30[5] > ema15[5] and
  277. ema60 > ema30 and
  278. ema60[1] > ema30[1] and
  279. ema60[2] > ema30[2] and
  280. ema60[3] > ema30[3] and
  281. ema60[4] > ema30[4] and
  282. ema60[5] > ema30[5]
  283. b3trendsell = ema30 < ema15 and
  284. ema30[1] < ema15[1] and
  285. ema30[2] < ema15[2] and
  286. ema30[3] < ema15[3] and
  287. ema30[4] < ema15[4] and
  288. ema30[5] < ema15[5] and
  289. ema60 < ema30 and
  290. ema60[1] < ema30[1] and
  291. ema60[2] < ema30[2] and
  292. ema60[3] < ema30[3] and
  293. ema60[4] < ema30[4] and
  294. ema60[5] < ema30[5]
  295. b3buycon = ema5 > ema15 and
  296. b3xcrossbuy and
  297. b3trendbuy and
  298. b3candlebuy and
  299. b3bigcandle and
  300. close > ema30 and
  301. close[1] < ema30[1] and
  302. close < ema60 and
  303. high < ema60
  304. b3sellcon = ema5 < ema15 and
  305. b3xcrosssell and
  306. b3trendsell and
  307. b3candlesell and
  308. b3bigcandle and
  309. close < ema30 and
  310. close[1] > ema30[1] and
  311. close > ema60 and
  312. low > ema60
  313. -- B3 Buy --
  314. plot_shape(b3buycon,
  315. "B3_Buy",
  316. shape_style.arrowup,
  317. shape_size.auto,
  318. colorBuy,
  319. shape_location.belowbar,
  320. 0,
  321. "B3",
  322. colorBuy
  323. )
  324. -- B3 Sell --
  325. plot_shape(b3sellcon,
  326. "B3_Sell",
  327. shape_style.arrowdown,
  328. shape_size.auto,
  329. colorSell,
  330. shape_location.abovebar,
  331. 0,
  332. "B3",
  333. colorSell
  334. )
  335. b4candlebuy = high[1] < ema200[1] and
  336. high[2] < ema200[2] and
  337. high[3] < ema200[3] and
  338. high[4] < ema200[4] and
  339. high[5] < ema200[5]
  340. b4candlesell = low[1] > ema200[1] and
  341. low[2] > ema200[2] and
  342. low[3] > ema200[3] and
  343. low[4] > ema200[4] and
  344. low[5] > ema200[5]
  345. b4xcrossbuy = ema5[1] < ema30[1] and
  346. ema5[2] < ema30[2] and
  347. ema5[3] < ema30[3] and
  348. ema5[4] < ema30[4] and
  349. ema5[5] < ema30[5]
  350. b4xcrosssell = ema5[1] > ema30[1] and
  351. ema5[2] > ema30[2] and
  352. ema5[3] > ema30[3] and
  353. ema5[4] > ema30[4] and
  354. ema5[5] > ema30[5]
  355. b4trendbuy = ema30 > ema15 and
  356. ema30[1] > ema15[1] and
  357. ema30[2] > ema15[2] and
  358. ema30[3] > ema15[3] and
  359. ema30[4] > ema15[4] and
  360. ema60 > ema30 and
  361. ema60[1] > ema30[1] and
  362. ema60[2] > ema30[2] and
  363. ema60[3] > ema30[3] and
  364. ema60[4] > ema30[4]
  365. b4trendsell = ema30 < ema15 and
  366. ema30[1] < ema15[1] and
  367. ema30[2] < ema15[2] and
  368. ema30[3] < ema15[3] and
  369. ema30[4] < ema15[4] and
  370. ema60 < ema30 and
  371. ema60[1] < ema30[1] and
  372. ema60[2] < ema30[2] and
  373. ema60[3] < ema30[3] and
  374. ema60[4] < ema30[4]
  375. b4bigcandle = abs(close-open) > abs(close[1]-open[1]) and
  376. abs(close-open) > abs(close[2]-open[2]) and
  377. abs(close-open) > abs(close[3]-open[3]) and
  378. abs(close-open) > abs(close[4]-open[4])
  379. b4buycon = ema5 > ema30 and
  380. b4xcrossbuy and
  381. b4trendbuy and
  382. b4candlebuy and
  383. b4bigcandle and
  384. close > ema60 and
  385. close < ema200 and
  386. high < ema200
  387. b4sellcon = ema5 < ema30 and
  388. b4xcrosssell and
  389. b4trendsell and
  390. b4candlesell and
  391. b4bigcandle and
  392. close < ema60 and
  393. close > ema200 and
  394. low > ema200
  395. -- B4 Buy --
  396. plot_shape(b4buycon,
  397. "B4_Buy",
  398. shape_style.arrowup,
  399. shape_size.auto,
  400. colorBuy,
  401. shape_location.belowbar,
  402. 0,
  403. "B4",
  404. colorBuy
  405. )
  406. -- B4 Sell --
  407. plot_shape(b4sellcon,
  408. "B4_Sell",
  409. shape_style.arrowdown,
  410. shape_size.auto,
  411. colorSell,
  412. shape_location.abovebar,
  413. 0,
  414. "B4",
  415. colorSell
  416. )
  417. if b5_visible then
  418. b5xcrossbuy = ema5[1] < ema60[1] and
  419. ema5[2] < ema60[2] and
  420. ema5[3] < ema60[3] and
  421. ema5[4] < ema60[4] and
  422. ema5[5] < ema60[5] and
  423. ema5[6] < ema60[6] and
  424. ema5[7] < ema60[7] and
  425. ema5[8] < ema60[8] and
  426. ema5[9] < ema60[9]
  427. b5xcrosssell = ema5[1] > ema60[1] and
  428. ema5[2] > ema60[2] and
  429. ema5[3] > ema60[3] and
  430. ema5[4] > ema60[4] and
  431. ema5[5] > ema60[5] and
  432. ema5[6] > ema60[6] and
  433. ema5[7] > ema60[7] and
  434. ema5[8] > ema60[8] and
  435. ema5[9] > ema60[9]
  436. b5buytrend = ema5 > ema15 and
  437. ema5[1] > ema15[1] and
  438. ema5[2] > ema15[2] and
  439. ema5[3] > ema15[3] and
  440. ema5[4] > ema15[4]
  441. b5selltrend = ema5 < ema15 and
  442. ema5[1] < ema15[1] and
  443. ema5[2] < ema15[2] and
  444. ema5[3] < ema15[3] and
  445. ema5[4] < ema15[4]
  446. b5buycon = ema5 > ema60 and
  447. b5xcrossbuy and
  448. b5buytrend and
  449. ema15 > ema30 and
  450. ema15 < ema60 and
  451. close > ema5 and
  452. close > ema60
  453. b5sellcon = ema5 < ema60 and
  454. b5xcrosssell and
  455. b5selltrend and
  456. ema15 < ema30 and
  457. ema15 > ema60 and
  458. close < ema5 and
  459. close < ema60
  460. -- B5 Buy Signal --
  461. plot_shape(b5buycon,
  462. "B5_Buy",
  463. shape_style.arrowup,
  464. shape_size.auto,
  465. colorBuy,
  466. shape_location.belowbar,
  467. 0,
  468. "B5",
  469. colorBuy
  470. )
  471. -- B5 Sell Signal --
  472. plot_shape(b5sellcon,
  473. "B5_Sell",
  474. shape_style.arrowdown,
  475. shape_size.auto,
  476. colorSell,
  477. shape_location.abovebar,
  478. 0,
  479. "B5",
  480. colorSell
  481. )
  482.  
Success #stdin #stdout 0.03s 25916KB
stdin
Standard input is empty
stdout
-----------------------------------------------------------------
---- "UPGRADE CDST v3.0 FULL VERSION ----------------------------
---- CREATE BY "KITTITAT WASATI" --------------------------------
---- Youtube: https://w...content-available-to-author-only...e.com/c/KittitatWasati ----------
-----------------------------------------------------------------
---- Hello all from THAILAND! -----------------------------------
---- This Indicator make for trading binary option --------------
---- It is suitable for beginners and make begin to trader ------
---- This is not financial advice -------------------------------
---- keep calm and stay cool ------------------------------------
instrument { name = "UCDST v3 FULL",
             icon="indicators:MACD",
             overlay = true
           }
-- EMA setting --
e5 = input (5, "fastMa", input.integer, 3,250,1)
e15 = input (15, "slowMa", input.integer, 3,250,1)
e30 = input (30, "middleMA", input.integer, 3,250,1)
e60 = input (60, "trendMA", input.integer, 3,250,1)
s5 = input (5, "SMA", input.integer, 1,250,1)
------ input group ------
-- Line & Fill --
input_group {
   "Line & Fill",
   color1 = input { default = "#26a8ff", type = input.color },
   color2 = input { default = "#ffff01", type = input.color },
   color3 = input { default = "#ffffff", type = input.color },
   color4 = input { default = "#ff0101", type = input.color },
   width = input { default = 1, type = input.line_width},
   fill_a_color = input { default  = rgba(255,88,77,0.15), type = input.color },
   fill_b_color = input { default = rgba(43,225,135,0.15), type = input.color },
   fill_c_color = input { default = rgba(38,168,255,0.15), type = input.color },
   visible = input { default = false, type = input.plot_visibility }
}
-- Arrow --
input_group {
   "Color Arrow",
   colorBuy = input { default = "#08FE0B", type = input.color },
   colorSell = input { default = "#FF0909", type = input.color },
   width = input { default = true, type = input.line_width}
}
-- b1 Signal --
input_group {
   "B1 SIGNAL (1 MINUTE TRADING)",
    b1_visible = input { default = false, type = input.plot_visibility }
}
input_group {
   "B2 SIGNAL (2 MINUTE TRADING)",
    b2_visible = input { default = false, type = input.plot_visibility }
}
input_group {
   "B3 SIGNAL (3 MINUTE TRADING)",
    b3_visible = input { default = false, type = input.plot_visibility }
}
input_group {
   "B4 SIGNAL (4 MINUTE TRADING)",
    b4_visible = input { default = false, type = input.plot_visibility }
}
input_group {
   "B5 SIGNAL (5 MINUTE TRADING)",
    b5_visible = input { default = false, type = input.plot_visibility }
}
-- color of sma5 --
input_group {
   "SMA5",
   color5 = input { default = "#26a8ff", type = input.color },
   width2 = input { default = 1, type = input.line_width },
   sma5_visible = input { default = false, type = input.plot_visibility }
}
-- backtester --
input_group {
   "--- BACKTESTER B1",
    b1check_visible = input { default = true, type = input.plot_visibility }
}
input_group {
   "--- BACKTESTER B1 REJECTION",
    b1rejectioncheck_visible = input { default = false, type = input.plot_visibility }
}
input_group {
   "-- BACKTESTER B2",
    b2check_visible = input { default = true, type = input.plot_visibility }
}
input_group {
   "-- BACKTESTER B3",
    b3check_visible = input { default = true, type = input.plot_visibility }
}
input_group {
   "-- BACKTESTER B4",
    b4check_visible = input { default = true, type = input.plot_visibility }
}
input_group {
   "-- BACKTESTER B5",
    b5check_visible = input { default = true, type = input.plot_visibility }
}
-- plot -- 
ema5 = ema (close, e5)
ema15 = ema (close, e15)
ema30 = ema (close, e30)
ema60 = ema (close, e60)
sma5 = sma (close, s5)
ema200 = ema(close, 200)
if sma5_visible then
    plot (sma5, "SMA5", color5, width2)
end
if visible then
plot (ema5, "EMA5", color1, width)
plot (ema15, "EMA15", color2, width)
plot (ema30, "EMA30", color3, width)
    fill (ema15, ema5, "", ema15 > ema5 and fill_b_color or fill_a_color)
    fill (ema15, ema30, "", ema15 > ema30 and fill_b_color or fill_a_color)
    fill (ema30, ema60, "", ema60 > ema30 and fill_c_color or fill_c_color)
end
-- B1 Condition --
b1candle4buy = close[1] < ema5[1] and
               close[2] < ema5[2] and
               close[3] < ema5[3] and
               close[4] < ema5[4] and
               open[1] < ema5[1] and
               open[2] < ema5[2] and
               open[3] < ema5[3] and
               open[4] < ema5[4]             
b1candle4sell = close[1] > ema5[1] and    
                close[2] > ema5[2] and
                close[3] > ema5[3] and
                close[4] > ema5[4] and
                open[1] > ema5[1] and
                open[2] > ema5[2] and
                open[3] > ema5[3] and
                open[4] > ema5[4]            
bigcandlebuy = abs(open-close) > abs(high-close)*3
bigcandlesell = abs(open-close) > abs(low-close)*3
bigcandle = abs(close-open) > abs(close[1]-open[1]) and
            abs(close-open) > abs(close[2]-open[2]) and
            abs(close-open) > abs(close[3]-open[3]) and
            abs(close-open) > abs(close[4]-open[4])
b1buycon = open < ema5 and
           close > ema5 and
           b1candle4buy and
           bigcandlebuy and
           bigcandle and
           close < ema15 and
           high < ema15 and
           ema15 > ema5 and
           ema30 > ema15
b1sellcon = open > ema5 and
            close < ema5 and
            b1candle4sell and
            bigcandlesell and
            bigcandle and
            close > ema15 and
            low > ema15 and
            ema15 < ema5 and
            ema30 < ema15
-- end of B1 Condition --

if b1_visible then 
-- B1 Buy --        
    plot_shape(b1buycon,
        "B1_Buy",
        shape_style.arrowup,
        shape_size.auto,
        colorBuy,
        shape_location.belowbar,
        0,
        "B1",
        colorBuy     
    )
-- B1 Sell --
    plot_shape(b1sellcon,
        "B1_Sell",
        shape_style.arrowdown,
        shape_size.auto,
        colorSell,
        shape_location.abovebar,
        0,
        "B1",
        colorSell     
    )
end
b2candle4buy = close[1] < ema15[1] and
               close[2] < ema15[2] and
               close[3] < ema15[3] and
               close[4] < ema15[4] and
               open[1] < ema15[1] and
               open[2] < ema15[2] and
               open[3] < ema15[3] and
               open[4] < ema15[4] and
               abs(open-close) > abs(high-close)*3
b2candle4sell = close[1] > ema15[1] and    
                close[2] > ema15[2] and
                close[3] > ema15[3] and
                close[4] > ema15[4] and
                open[1] > ema15[1] and
                open[2] > ema15[2] and
                open[3] > ema15[3] and
                open[4] > ema15[4] and
                abs(open-close) > abs(low-close)*3
b2bigcandle = abs(close-open) > abs(close[1]-open[1]) and
              abs(close-open) > abs(close[2]-open[2]) and
              abs(close-open) > abs(close[3]-open[3]) and
              abs(close-open) > abs(close[4]-open[4])
b2bigcandlebuy = close > high[1] and
                 close > high[2] and
                 close > high[3] and
                 close > high[4]
b2bigcandlesell = close < low[1] and
                  close < low[2] and
                  close < low[3] and
                  close < low[4]
b2buycon = open < ema15 and 
           close > ema15 and
           b2candle4buy and
           b2bigcandle and
           b2bigcandlebuy and
           high < ema30 and
           ema60 > ema30 and
           ema30 > ema15 and
           ema15 > ema5
b2sellcon = open > ema15 and 
            close < ema15 and
            b2candle4sell and
            b2bigcandle and
            b2bigcandlesell and
            low > ema30 and
            ema60 < ema30 and
            ema30 < ema15 and
            ema15 < ema5
-- B2 Buy --
    plot_shape(b2buycon,
        "B2_Buy",
        shape_style.arrowup,
        shape_size.auto,
        colorBuy,
        shape_location.belowbar,
        0,
        "B2",
        colorBuy     
    )
-- B2 Sell --
    plot_shape(b2sellcon,
        "B2_Sell",
        shape_style.arrowdown,
        shape_size.auto,
        colorSell,
        shape_location.abovebar,
        0,
        "B2",
        colorSell     
    )
end
b3candlebuy = high[1] < ema30[1] and
              high[2] < ema30[2] and
              high[3] < ema30[3] and
              high[4] < ema30[4] and
              high[5] < ema30[5]
b3candlesell = low[1] > ema30[1] and
               low[2] > ema30[2] and
               low[3] > ema30[3] and
               low[4] > ema30[4] and
               low[5] > ema30[5]
b3xcrossbuy = ema5[1] < ema15[1] and
              ema5[2] < ema15[2] and
              ema5[3] < ema15[3] and
              ema5[4] < ema15[4] and
              ema5[5] < ema15[5]
b3xcrosssell = ema5[1] > ema15[1] and
               ema5[2] > ema15[2] and
               ema5[3] > ema15[3] and
               ema5[4] > ema15[4] and
               ema5[5] > ema15[5]
b3bigcandle = abs(close-open) > abs(close[1]-open[1]) and
              abs(close-open) > abs(close[2]-open[2]) and
              abs(close-open) > abs(close[3]-open[3]) and
              abs(close-open) > abs(close[4]-open[4])
b3trendbuy = ema30 > ema15 and
             ema30[1] > ema15[1] and
             ema30[2] > ema15[2] and
             ema30[3] > ema15[3] and
             ema30[4] > ema15[4] and
             ema30[5] > ema15[5] and
             ema60 > ema30 and
             ema60[1] > ema30[1] and
             ema60[2] > ema30[2] and
             ema60[3] > ema30[3] and
             ema60[4] > ema30[4] and
             ema60[5] > ema30[5]
b3trendsell = ema30 < ema15 and
              ema30[1] < ema15[1] and
              ema30[2] < ema15[2] and
              ema30[3] < ema15[3] and
              ema30[4] < ema15[4] and
              ema30[5] < ema15[5] and
              ema60 < ema30 and
              ema60[1] < ema30[1] and
              ema60[2] < ema30[2] and
              ema60[3] < ema30[3] and
              ema60[4] < ema30[4] and
              ema60[5] < ema30[5]
b3buycon = ema5 > ema15 and
           b3xcrossbuy and
           b3trendbuy and
           b3candlebuy and
           b3bigcandle and
           close > ema30 and
           close[1] < ema30[1] and
           close < ema60 and
           high < ema60
b3sellcon = ema5 < ema15 and
            b3xcrosssell and
            b3trendsell and
            b3candlesell and
            b3bigcandle and
            close < ema30 and
            close[1] > ema30[1] and
            close > ema60 and
            low > ema60
-- B3 Buy --
    plot_shape(b3buycon,
        "B3_Buy",
        shape_style.arrowup,
        shape_size.auto,
        colorBuy,
        shape_location.belowbar,
        0,
        "B3",
        colorBuy     
    )
-- B3 Sell --
    plot_shape(b3sellcon,
        "B3_Sell",
        shape_style.arrowdown,
        shape_size.auto,
        colorSell,
        shape_location.abovebar,
        0,
        "B3",
        colorSell     
    )
end
b4candlebuy = high[1] < ema200[1] and
              high[2] < ema200[2] and
              high[3] < ema200[3] and
              high[4] < ema200[4] and
              high[5] < ema200[5]
b4candlesell = low[1] > ema200[1] and
               low[2] > ema200[2] and
               low[3] > ema200[3] and
               low[4] > ema200[4] and
               low[5] > ema200[5]
b4xcrossbuy = ema5[1] < ema30[1] and
              ema5[2] < ema30[2] and
              ema5[3] < ema30[3] and
              ema5[4] < ema30[4] and
              ema5[5] < ema30[5]
b4xcrosssell = ema5[1] > ema30[1] and
               ema5[2] > ema30[2] and
               ema5[3] > ema30[3] and
               ema5[4] > ema30[4] and
               ema5[5] > ema30[5]
b4trendbuy = ema30 > ema15 and
             ema30[1] > ema15[1] and
             ema30[2] > ema15[2] and
             ema30[3] > ema15[3] and
             ema30[4] > ema15[4] and
             ema60 > ema30 and
             ema60[1] > ema30[1] and
             ema60[2] > ema30[2] and
             ema60[3] > ema30[3] and
             ema60[4] > ema30[4]
b4trendsell = ema30 < ema15 and
              ema30[1] < ema15[1] and
              ema30[2] < ema15[2] and
              ema30[3] < ema15[3] and
              ema30[4] < ema15[4] and
              ema60 < ema30 and
              ema60[1] < ema30[1] and
              ema60[2] < ema30[2] and
              ema60[3] < ema30[3] and
              ema60[4] < ema30[4]
b4bigcandle = abs(close-open) > abs(close[1]-open[1]) and
              abs(close-open) > abs(close[2]-open[2]) and
              abs(close-open) > abs(close[3]-open[3]) and
              abs(close-open) > abs(close[4]-open[4])
b4buycon = ema5 > ema30 and
           b4xcrossbuy and
           b4trendbuy and
           b4candlebuy and
           b4bigcandle and
           close > ema60 and
           close < ema200 and
           high < ema200
b4sellcon = ema5 < ema30 and
            b4xcrosssell and
            b4trendsell and
            b4candlesell and
            b4bigcandle and
            close < ema60 and
            close > ema200 and
            low > ema200
-- B4 Buy --
    plot_shape(b4buycon,
        "B4_Buy",
        shape_style.arrowup,
        shape_size.auto,
        colorBuy,
        shape_location.belowbar,
        0,
        "B4",
        colorBuy     
    )
-- B4 Sell --
    plot_shape(b4sellcon,
        "B4_Sell",
        shape_style.arrowdown,
        shape_size.auto,
        colorSell,
        shape_location.abovebar,
        0,
        "B4",
        colorSell     
    )
end
if b5_visible then
b5xcrossbuy = ema5[1] < ema60[1] and 
              ema5[2] < ema60[2] and
              ema5[3] < ema60[3] and
              ema5[4] < ema60[4] and
              ema5[5] < ema60[5] and
              ema5[6] < ema60[6] and
              ema5[7] < ema60[7] and
              ema5[8] < ema60[8] and
              ema5[9] < ema60[9] 
b5xcrosssell = ema5[1] > ema60[1] and 
               ema5[2] > ema60[2] and
               ema5[3] > ema60[3] and
               ema5[4] > ema60[4] and
               ema5[5] > ema60[5] and
               ema5[6] > ema60[6] and
               ema5[7] > ema60[7] and
               ema5[8] > ema60[8] and
               ema5[9] > ema60[9]
b5buytrend = ema5 > ema15 and
             ema5[1] > ema15[1] and
             ema5[2] > ema15[2] and
             ema5[3] > ema15[3] and
             ema5[4] > ema15[4]
b5selltrend = ema5 < ema15 and
              ema5[1] < ema15[1] and
              ema5[2] < ema15[2] and
              ema5[3] < ema15[3] and
              ema5[4] < ema15[4]
b5buycon = ema5 > ema60 and
           b5xcrossbuy and
           b5buytrend and
           ema15 > ema30 and
           ema15 < ema60 and
           close > ema5 and
           close > ema60
b5sellcon = ema5 < ema60 and
            b5xcrosssell and
            b5selltrend and
            ema15 < ema30 and
            ema15 > ema60 and
            close < ema5 and
            close < ema60
-- B5 Buy Signal --            
    plot_shape(b5buycon,
        "B5_Buy",
        shape_style.arrowup,
        shape_size.auto,
        colorBuy,
        shape_location.belowbar,
        0,
        "B5",
        colorBuy     
    )
-- B5 Sell Signal --
    plot_shape(b5sellcon,
        "B5_Sell",
        shape_style.arrowdown,
        shape_size.auto,
        colorSell,
        shape_location.abovebar,
        0,
        "B5",
        colorSell    
    )
end