// This code is created by algopoint.
All other leaked algos is available at
algopoint.mysellix.io
// AlgoPoint Official Contact Adrress
// Instagram: algopoint
// Instagram: algopoint01
// Website: algopoint.mysellix.io
// Mail:
[email protected]//@version=5
indicator("EzAlgo Sniper Entry Pro [AlgoPoint]",shorttitle="AlgoPoint™️| EzAlgo
Sniper Entry Pro", overlay=true,max_bars_back = 500, max_labels_count = 500)
import TradingView/ta/7
// Entry Zone
barsLL=input.float(defval = 5, maxval= 8, minval =1, step = 0.5,title='Swing
Length', group = 'Entry Zone')
tradedirection = input.string(title='Signal Type', defval = 'Both', options =
['Both', 'Bullish', 'Bearish'], inline = 'A1', group = 'Entry Zone')
allsignals = input.bool(defval = true, title = 'All Trades ', group = 'Entry Zone',
inline = 'A1')
showentryzones = input.bool(defval = true, title = 'Show Entry Zone', group =
'Entry Zone', inline = '4')
zone2= #ffffff00//showentryzones == true ? input(color.rgb(140, 140, 140,
99),title="", group = 'Entry Zone', inline="4") : #ffffff00
zone1bull= showentryzones == true ? input(color.new(#00dbff, 95),title="", group =
'Entry Zone', inline="4") : #ffffff00
zone1bear= showentryzones == true ? input(color.new(#8e1947, 95),title="", group =
'Entry Zone', inline="4") : #ffffff00
showlabels = input.bool(defval = true, title = 'Labels', group = 'Entry Zone',
inline = '4')
// Filters
displacementfilter = input.bool(false, "Displacement Filter", group = 'Filters')
marketstructurefilter = input.bool(defval = false, title = 'Structure Filter',
group = 'Filters')
// Labels
labelsizee = input.string(title='Entry Label Size', defval = 'Small', options =
['Tiny', 'Small', 'Normal', 'Large'], group = 'Labels', inline = 'label')
labelsize = labelsizee == 'Tiny' ? size.tiny : labelsizee == 'Small' ? size.small :
labelsizee == 'Normal' ? size.normal : size.large
offset = input.int(defval = 1, title = 'Offset', minval = 0, maxval = 10, group =
'Labels', inline = 'label') - 0.5
buylabcol= input(color.new(#068c59, 20),title="Buy Labels", group = 'Labels',
inline="1")
dcabuylabcol= input(color.new(#068c59, 20),title="", group = 'Labels', inline="1")
selllabcol= input(color.new(#8e1947, 20),title="Sell Labels", group = 'Labels',
inline="2")
dcaselllabcol= input(color.new(#8e1947, 20),title="", group = 'Labels', inline="2")
// Bar Coloring
barcoloring = input.bool(defval = false, title = 'EzAlgo Colors', group = 'Bar
Coloring')
// Alerts
buyalertt = input.bool(title='Buy', defval=false, inline = "NBb", group='Alerts')
sellalertt = input.bool(title='Sell', defval=false, inline = "NBb", group='Alerts')
dcabuyalert = input.bool(title='Dca Buy', defval=false, inline = "NB",
group='Alerts')
dcasellalert = input.bool(title='DCA Sell', defval=false, inline = "NB",
group='Alerts')
// Advertisement
showwatermark = input.bool(true,'Watermark', group = 'Advertisement')
//
t_col=color.new(#787b86, 90)
//zone1=input(color.rgb(0, 255, 229, 89),title="Zone 1",inline="4")
offsetalgopoint = offset < 0 ? 0.5 : offset
y1 = offset < 0 ? low : low - (ta.atr(30) * offsetalgopoint)
y2 = offset < 0 ? high : high + (ta.atr(30) * offsetalgopoint)
buy = false
dcabuy = false
sell = false
dcasell = false
barsR=0
barsL = (barsLL * 10) * 2
boxNum=math.round(barsLL) <= 1 ? 2 : math.round(barsLL)
var bool hop = true
var int n = 1
var lastPivotType=0
var phIndex=0
var plIndex=0
var ph=0.0
var pl=0.0
var highp=0.0
var lowp=0.0
var lastLine=line.new(0,0,0,0)
var patTop=0.0
var patBottom=0.0
var l0=line.new(0,0,0,0,extend=extend.right,color=#4caf4f00,width=2)//leading point
var l1=line.new(0,0,0,0,extend=extend.right,color=#2195f300,width=2)//leading pl
var l2=line.new(0,0,0,0,extend=extend.right,color=#ff990000,width=2)//following
var l3=line.new(0,0,0,0,extend=extend.right,color=#df40fb00,width=2)//leading ph
var l4=line.new(0,0,0,0,extend=extend.right,color=#ff525200,width=2)//following
var leadPointVal=0.0
var lines= array.new_line(5)
array.set(lines,0,l0)
array.set(lines,1,l1)
array.set(lines,2,l2)
array.set(lines,3,l3)
array.set(lines,4,l4)
ph:=ta.pivothigh(high,barsL,barsR)
pl:= ta.pivotlow(low,barsL,barsR)
//Update the holding variables
if ph>0
highp:=ph
if pl>0
lowp:=pl
// Get the new index
phIndex:=ph?bar_index-barsR:phIndex[1]
plIndex:=pl?bar_index-barsR:plIndex[1]
// Update direction type
lastPivotType:= ph?1:pl?-1:barstate.isfirst?0:lastPivotType[1]
var d_newTrendFormed=0
//create new line set xy2 and get end of previous line NewUT
if lastPivotType!=lastPivotType[1] and lastPivotType==1
patTop:=high
patBottom:=line.get_y1(l0)
line.set_x1(array.get(lines,2),line.get_x2(array.get(lines,1))-1)
line.set_y1(array.get(lines,2),line.get_y2(array.get(lines,1)))
line.set_x2(array.get(lines,2),line.get_x2(array.get(lines,1))+1)
line.set_y2(array.get(lines,2),line.get_y2(array.get(lines,1)))
lastLine:=line.new(line.get_x1(lastLine),line.get_y1(lastLine),phIndex,high[bar_ind
ex-phIndex])
line.set_x1(array.get(lines,1),line.get_x1(lastLine))
line.set_y1(array.get(lines,1),line.get_y1(lastLine))
line.set_x2(array.get(lines,1),line.get_x1(lastLine)+1)
line.set_y2(array.get(lines,1),line.get_y1(lastLine))
line.set_x1(array.get(lines,0),line.get_x2(lastLine))
line.set_y1(array.get(lines,0),line.get_y2(lastLine))
line.set_x2(array.get(lines,0),line.get_x2(lastLine)+1)
line.set_y2(array.get(lines,0),line.get_y2(lastLine))
line.set_color(lastLine,t_col)
d_newTrendFormed:=1
//create new line set xy1 and get end of prevous line New DT
if lastPivotType!=lastPivotType[1] and lastPivotType==-1
patTop:=line.get_y1(l0)
patBottom:=low
line.set_x1(array.get(lines,4),line.get_x2(array.get(lines,3))-1)
line.set_y1(array.get(lines,4),line.get_y2(array.get(lines,3)))
line.set_x2(array.get(lines,4),line.get_x2(array.get(lines,3))+1)
line.set_y2(array.get(lines,4),line.get_y2(array.get(lines,3)))
lastLine:=line.new(plIndex,low[bar_index-
plIndex],line.get_x2(lastLine),line.get_y2(lastLine))
line.set_x1(array.get(lines,0),line.get_x1(lastLine))
line.set_y1(array.get(lines,0),line.get_y1(lastLine))
line.set_x2(array.get(lines,0),line.get_x1(lastLine)+1)
line.set_y2(array.get(lines,0),line.get_y1(lastLine))
line.set_x1(array.get(lines,3),line.get_x2(lastLine))
line.set_y1(array.get(lines,3),line.get_y2(lastLine))
line.set_x2(array.get(lines,3),line.get_x2(lastLine)+1)
line.set_y2(array.get(lines,3),line.get_y2(lastLine))
line.set_color(lastLine,t_col)
d_newTrendFormed:=-1
// Update Trend Down Line
if lastPivotType==lastPivotType[1] and lastPivotType==-1 and pl<lowp[1]
line.set_x1(lastLine[1],plIndex)
line.set_y1(lastLine[1],low[bar_index-plIndex])
line.set_color(lastLine[1],t_col)
line.set_x1(array.get(lines,0),line.get_x1(lastLine))
line.set_y1(array.get(lines,0),line.get_y1(lastLine))
line.set_x2(array.get(lines,0),line.get_x1(lastLine)+1)
line.set_y2(array.get(lines,0),line.get_y1(lastLine))
patBottom:=low
// Update Trend Up Line
textstylist = table.new('bottom' + '_' + 'right', 1, 3)
if lastPivotType==lastPivotType[1] and lastPivotType==1 and ph>highp[1]
line.set_x2(lastLine[1],phIndex)
line.set_y2(lastLine[1],high[bar_index-phIndex])
line.set_color(lastLine[1],t_col)
line.set_x1(array.get(lines,0),line.get_x2(lastLine))
line.set_y1(array.get(lines,0),line.get_y2(lastLine))
line.set_x2(array.get(lines,0),line.get_x2(lastLine)+1)
line.set_y2(array.get(lines,0),line.get_y2(lastLine))
patTop:=high
//Fibs********
var clear_col=color.new(color.white,100)
Fib(ratio) =>
valueRange= patTop-patBottom
if d_newTrendFormed==1
fibVal=patTop-(valueRange*ratio)
else
fibVal=patBottom+(valueRange*ratio)
var fib1=line.new(0,0,0,0,color=#4caf4f00)
var fib2=line.new(0,0,0,0,color=#2195f300)
var fib3=line.new(0,0,0,0,color=#ff990000)
var fibBase1=line.new(0,0,0,0,color=#9b27b000)
fibX=d_newTrendFormed==1?line.get_x1(l1):line.get_x1(l3)
fibY=d_newTrendFormed==1?l1:l3
line.set_xy1(fib1,fibX,Fib(0.786))
line.set_xy2(fib1,fibX+25,Fib(0.786))
line.set_xy1(fib2,fibX,Fib(0.5))
line.set_xy2(fib2,fibX+25,Fib(0.5))
line.set_xy1(fib3,fibX,Fib(0.618))
line.set_xy2(fib3,fibX+25,Fib(0.618))
base=d_newTrendFormed==-1?patTop:patBottom
line.set_xy1(fibBase1,fibX,base)
line.set_xy2(fibBase1,fibX+25,base)
plotchar(patTop,title="Top",char="")
plotchar(patBottom,title="Bottom",char="")
bosLCdOneLookback=bar_index-line.get_x1(array.get(lines,3))
bosLCdOneindex=ta.lowestbars(low,math.max(bosLCdOneLookback,1))
bosLCdTwoLookback=bar_index-line.get_x1(array.get(lines,4))
bosLCdTwoindex=ta.lowestbars(low,math.max(bosLCdTwoLookback,1))
var boxArrayL=array.new_box()
var boxArrayTestedL=array.new_bool()
var boxArrayLz1=array.new_box()
var boxArrayTestedLz1=array.new_bool()
if d_newTrendFormed==1 and d_newTrendFormed[1]==-1
b1=box.new(bosLCdOneindex+bar_index,line.get_y1(fib1),bar_index,low[math.abs(bosLCd
Oneindex)],bgcolor=zone2,border_color = color.rgb(76, 175, 79, 100))
b2=box.new(bosLCdOneindex+bar_index,line.get_y1(fib1),bar_index,line.get_y1(fib3),b
gcolor=zone1bull,border_color = color.rgb(76, 175, 79, 100))
if array.size(boxArrayL)>=boxNum
box.delete(array.get(boxArrayL,boxNum-1))
array.pop(boxArrayL)
array.pop(boxArrayTestedL)
array.unshift(boxArrayL,b1)
array.unshift(boxArrayTestedL,false)
if array.size(boxArrayLz1)>=boxNum
box.delete(array.get(boxArrayLz1,boxNum-1))
array.pop(boxArrayLz1)
array.pop(boxArrayTestedLz1)
array.unshift(boxArrayLz1,b2)
array.unshift(boxArrayTestedLz1,false)
if d_newTrendFormed==1 and array.size(boxArrayL)>1
if array.get(boxArrayTestedLz1,0)==false
box.set_top(array.get(boxArrayL,0),line.get_y1(fib1))
box.set_bottom(array.get(boxArrayLz1,0),box.get_top(array.get(boxArrayL,0)))
box.set_top(array.get(boxArrayLz1,0),line.get_y1(fib3))
// //Short Side
d_boms_S=false
bosSCdOneLookback=bar_index-line.get_x1(array.get(lines,1))
bosSCdOneindex=ta.highestbars(high,math.max(bosSCdOneLookback,1))
bosSCdTwoLookback=bar_index-line.get_x1(array.get(lines,2))
bosSCdTwoindex=ta.highestbars(high,math.max(bosSCdTwoLookback,1))
var boxArrayS=array.new_box()
var boxArrayTestedS=array.new_bool()
var boxArraySz1=array.new_box()
var boxArrayTestedSz1=array.new_bool()
randwatermark = math.round(math.random(1,3,6))
if d_newTrendFormed==-1 and d_newTrendFormed[1]==1
b1=box.new(bosSCdOneindex+bar_index,high[math.abs(bosSCdOneindex)],bar_index,line.g
et_y1(fib1),bgcolor=zone2,border_color = color.rgb(255, 82, 82, 100))
b2=box.new(bosSCdOneindex+bar_index,line.get_y1(fib1),bar_index,line.get_y1(fib3),b
gcolor=zone1bear,border_color = color.rgb(255, 82, 82, 100))
if array.size(boxArrayS)>=boxNum
box.delete(array.get(boxArrayS,boxNum-1))
array.pop(boxArrayS)
array.pop(boxArrayTestedS)
array.unshift(boxArrayS,b1)
array.unshift(boxArrayTestedS,false)
if array.size(boxArraySz1)>=boxNum
box.delete(array.get(boxArraySz1,boxNum-1))
array.pop(boxArraySz1)
array.pop(boxArrayTestedSz1)
array.unshift(boxArraySz1,b2)
array.unshift(boxArrayTestedSz1,false)
if d_newTrendFormed==-1 and array.size(boxArrayS)>1
if array.get(boxArrayTestedSz1,0)==false
box.set_bottom(array.get(boxArrayS,0),line.get_y1(fib1))
box.set_top(array.get(boxArraySz1,0),box.get_bottom(array.get(boxArrayS,0)))
box.set_bottom(array.get(boxArraySz1,0),line.get_y1(fib3))
//Update L Boxes
// . . . . . . . . . .
//_.` `._.` `._.` `._.` `._.` `._.` `._.` `._.` `._.` `._.` `.
if array.size(boxArrayL) > 1 and barstate.isconfirmed
for i=0 to array.size(boxArrayL)-1
if low >= box.get_top(array.get(boxArrayL,i)) and
array.get(boxArrayTestedL,i)==false
box.set_right(array.get(boxArrayL,i),bar_index+1)
else
array.set(boxArrayTestedL,i,true)
if array.size(boxArrayL) > 0 and barstate.isconfirmed
for i=0 to array.size(boxArrayL)-1
if low < box.get_top(array.get(boxArrayL,i)) and low[1] >
box.get_top(array.get(boxArrayL,i)) and box.get_right(array.get(boxArrayL,i)) >
bar_index-1
dcabuy := true
// . . . . . . . . . .
//_.` `._.` `._.` `._.` `._.` `._.` `._.` `._.` `._.` `._.` `.
if array.size(boxArrayLz1) > 1 and barstate.isconfirmed
for i=0 to array.size(boxArrayLz1)-1
if low >= box.get_top(array.get(boxArrayLz1,i)) and
array.get(boxArrayTestedLz1,i)==false
box.set_right(array.get(boxArrayLz1,i),bar_index+1)
else
array.set(boxArrayTestedLz1,i,true)
if array.size(boxArrayLz1) > 0 and barstate.isconfirmed
for i=0 to array.size(boxArrayLz1)-1
if low < box.get_top(array.get(boxArrayLz1,i)) and low[1] >
box.get_top(array.get(boxArrayLz1,i)) and box.get_right(array.get(boxArrayLz1,i)) >
bar_index-1
buy := true
// . . . . . . . . . .
//_.` `._.` `._.` `._.` `._.` `._.` `._.` `._.` `._.` `._.` `.
if array.size(boxArrayS) > 0 and barstate.isconfirmed
for i=0 to array.size(boxArrayS)-1
if high <= box.get_bottom(array.get(boxArrayS,i)) and
array.get(boxArrayTestedS,i)==false
box.set_right(array.get(boxArrayS,i),bar_index+1)
else
array.set(boxArrayTestedS,i,true)
if array.size(boxArrayS) > 0 and barstate.isconfirmed
for i=0 to array.size(boxArrayS)-1
if high > box.get_bottom(array.get(boxArrayS,i)) and high[1] <
box.get_bottom(array.get(boxArrayS,i)) and box.get_right(array.get(boxArrayS,i)) >
bar_index-1
dcasell := true
// . . . . . . . . . .
//_.` `._.` `._.` `._.` `._.` `._.` `._.` `._.` `._.` `._.` `.
//Update S Boxes
if array.size(boxArraySz1) > 0 and barstate.isconfirmed
for i=0 to array.size(boxArraySz1)-1
if high <= box.get_bottom(array.get(boxArraySz1,i)) and
array.get(boxArrayTestedSz1,i)==false
box.set_right(array.get(boxArraySz1,i),bar_index+1)
else
array.set(boxArrayTestedSz1,i,true)
if array.size(boxArraySz1) > 0 and barstate.isconfirmed
for i=0 to array.size(boxArraySz1)-1
if high > box.get_bottom(array.get(boxArraySz1,i)) and high[1] <
box.get_bottom(array.get(boxArraySz1,i)) and
box.get_right(array.get(boxArraySz1,i)) > bar_index-1
sell := true
// . . . . . . . . . .
//_.` `._.` `._.` `._.` `._.` `._.` `._.` `._.` `._.` `._.` `.
// Filter Element's
// Structure Filter
left = barsLL * 10
right = left
pvh = ta.pivothigh(left, right)
pvl = ta.pivotlow(left, right)
var float phms = na
var float plms = na
phms := pvh != 0 ? pvh : phms[1]
plms := pvl != 0 ? pvl : plms[1]
currenth = ta.valuewhen(pvh != 0, high[right], 0)
lasth = ta.valuewhen(pvh != 0, high[right], 1)
currentl = ta.valuewhen(pvl != 0, low[right], 0)
lastl = ta.valuewhen(pvl != 0, low[right], 1)
title = randwatermark == 3 ? 'Social Accounts' : 'This Algo Created By AlgoPoint'
var int ms = na
ms := if currenth > lasth and currentl > lastl and close > phms
ms := 2
else if close > phms
ms := 1
else if currenth < lasth and currentl < lastl and close < plms
ms := -2
else if close < plms
ms := -1
else
ms[1]
var int last = na
longsig = close > phms and ms[1] < 0
shortsig = close < plms and ms[1] > 0
// Displacement Filter
require_fvg = true
disp_type = "Open to Close"
std_len = 100
std_x = 2
disp_color = #ffffff00
candle_range = disp_type == "Open to Close" ? math.abs(open - close) : high - low
std = ta.stdev(candle_range, std_len) * std_x
fvg = close[1] > open[1] ? high[2] < low[0] : low[2] > high[0]
displacement = require_fvg ? candle_range[1] > std[1] and fvg : candle_range > std
displacementinvalue = displacement ? 1 : 0
// Bar Since's
longmssince = ta.barssince(longsig)
shortmssince = ta.barssince(shortsig)
dcabuysince = ta.barssince(dcabuy)
buysince = ta.barssince(buy)
dcasellsince = ta.barssince(dcasell)
sellsince = ta.barssince(sell)
displacementhistorybuy = ta.valuewhen(buy,displacementinvalue,0)
displacementhistorysell = ta.valuewhen(sell,displacementinvalue,0)
// Filter Conditions
// All Signal Option
allsignalsbull = allsignals == true ? true : allsignals == false and buysince <
sellsince and buysince[1] > sellsince ? true : false
allsignalsbear = allsignals == true ? true : allsignals == false and sellsince <
buysince and sellsince[1] > buysince ? true : false
// Structure Filter
longms = marketstructurefilter == false ? true : marketstructurefilter == true and
shortmssince > longmssince ? true : false
shortms = marketstructurefilter == false ? true : marketstructurefilter == true and
longmssince > shortmssince ? true : false
// Displacement Filter
displacementlastfilter = displacementfilter == false ? true : displacementfilter ==
true and displacement ? false : true
dcadisplacementfilterbuy = displacementfilter == false ? true :
displacementhistorybuy == 0 ? true : false
dcadisplacementfiltersell = displacementfilter == false ? true :
displacementhistorysell == 0 ? true : false
subtitle = randwatermark == 1 ? 'Get 20% discount with ALGO20 coupon for your next
purchase' : randwatermark == 2 ? 'Get All Leaked Codes:
www.algopoint.mysellix.io' : randwatermark == 3 ? 'Website: algopoint.mysellix.io \
nInstagram: @algopoint \nYoutube: @algopoint ' : 'Get All Leaked Codes:
www.algopoint.mysellix.io'
bulllastcondition = allsignalsbull == true and longms == true and
displacementlastfilter == true
bearlastcondition = allsignalsbear == true and shortms == true and
displacementlastfilter == true
allsignalbullsince = ta.barssince(bulllastcondition)
allsignalbearsince = ta.barssince(bearlastcondition)
var allsignalsdcabullaccepted = true
var allsignalsdcabearaccepted = true
if (ta.crossunder(allsignalbullsince, allsignalbearsince) or
ta.crossover(allsignalbearsince, allsignalbullsince))
allsignalsdcabearaccepted := false
allsignalsdcabullaccepted := true
if (ta.crossunder(allsignalbearsince, allsignalbullsince) or
ta.crossover(allsignalbullsince, allsignalbearsince))
allsignalsdcabullaccepted := false
allsignalsdcabearaccepted := true
//allsignaldcabull = allsignals == true ? true : allsignals == false and
allsignalsdcabullaccepted == true ? true : false
//allsignaldcabear = allsignals == true ? true : allsignals == false and
allsignalsdcabearaccepted == true ? true : false
allsignaldcabull = allsignalsdcabullaccepted == true ? true : false
allsignaldcabear = allsignalsdcabearaccepted == true ? true : false
bulldirection = tradedirection == 'Both' ? true : tradedirection == 'Bullish' ?
true : false
beardirecton = tradedirection == 'Both' ? true : tradedirection == 'Bearish' ? true
: false
//Alerts
if buyalertt and buy and allsignalsbull and bulldirection and longms and
displacementlastfilter and showlabels
alert('Buy',alert.freq_once_per_bar)
if sellalertt and sell and allsignalsbear and beardirecton and shortms and
displacementlastfilter and showlabels
alert('Sell',alert.freq_once_per_bar)
if dcabuyalert and dcabuy and allsignaldcabull and bulldirection and showlabels and
dcadisplacementfilterbuy
alert('DCA Buy',alert.freq_once_per_bar)
if dcasellalert and dcasell and allsignaldcabear and beardirecton and showlabels
and dcadisplacementfiltersell
alert('DCA Sell',alert.freq_once_per_bar)
// Label Plots
if dcabuy and allsignaldcabull and bulldirection and showlabels and
dcadisplacementfilterbuy
label.new(bar_index , y1, 'DCA Buy', color=dcabuylabcol,
style=label.style_label_up, textcolor=color.white, size=labelsize)
if allsignals == false
allsignalsdcabullaccepted := false
if buy and allsignalsbull and bulldirection and longms and displacementlastfilter
and showlabels
label.new(bar_index , y1, 'Buy', color=buylabcol, style=label.style_label_up,
textcolor=color.white, size=labelsize)
if dcasell and allsignaldcabear and beardirecton and showlabels and
dcadisplacementfiltersell
label.new(bar_index , y2, 'DCA Sell', color=dcaselllabcol,
style=label.style_label_down, textcolor=color.white, size=labelsize)
if allsignals == false
allsignalsdcabearaccepted := false
if sell and allsignalsbear and beardirecton and shortms and displacementlastfilter
and showlabels
label.new(bar_index , y2, 'Sell', color=selllabcol,
style=label.style_label_down, textcolor=color.white, size=labelsize)
if showwatermark
table.cell(textstylist, 0, 0, title, 0, 0, #b2b5be80, 'right',
text_size='large', bgcolor=color.new(color.blue, 100))
table.cell(textstylist, 0, 1, subtitle, 0, 0, #b2b5be80, 'right',
text_size='normal', bgcolor=color.new(color.blue, 100))
// Bar Coloring
// Input
[_, _, macd] = ta.macd(close, 12, 26, 9)
fastLength = 12
slowLength = 26
srcceed = close
signalLength = 9
// Data reference
[macdda, signal, hist] = ta.macd(srcceed, fastLength, slowLength, signalLength)
// 4 level of green
greenHighh = #00dbff
greenMidHighh = #61eaff
greenMidLowh = #40e6ff
greenLowh = #61eaff
// Yellow
yellowLowh = #80eeff
// 4 level of red
redHighh = #a1f3ff
redMidHighh = #c0f7ff
redMidLowh = #e0fbff
redLowh = #FFFFFF
// Default color
candleBodyd = yellowLowh
// Ranging trend
if hist > 0
if hist > hist[1] and hist[1] > 0
candleBodyd := greenLowh
if hist < 0
if hist < hist[1] and hist[1] < 0
candleBodyd := redLowh
// Bullish trend
if macdda > 0 and hist > 0
candleBodyd := greenMidLowh
if hist > hist[1] and macd[1] > 0 and hist[1] > 0
candleBodyd := greenMidHighh
if hist > hist[2] and macd[2] > 0 and hist[2] > 0
candleBodyd := greenHighh
// Bearish trend
if macdda < 0 and hist < 0
candleBodyd := redMidLowh
if hist < hist[1] and macd[1] < 0 and hist[1] < 0
candleBodyd := redMidHighh
if hist < hist[2] and macd[2] < 0 and hist[2] < 0
candleBodyd := redHighh
barcolor(barcoloring ? candleBodyd : na) // Include suggestion by Shaheen204
//