Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
28 views29 pages

Flux Charts

Trading view

Uploaded by

GAGAN RAJU
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
28 views29 pages

Flux Charts

Trading view

Uploaded by

GAGAN RAJU
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 29

//OneAbobeAll

//@version=5
const bool DEBUG = false
indicator("SWEETLIFE 2", overlay = true, max_labels_count = 500, max_lines_count =
500, max_boxes_count = 500, max_bars_back = 300, dynamic_requests = true)

const int timeframeCount = 3


const float touchATR = 1.0 / 30.0
const float retestATR = 1.0 / 30.0
const float labelOffsetY = 1.5
const int labelOffsetsXIndex = 30
const int maxPivotsBackSR = 15
const int retestLabelEveryXBars = 3
const int maxTraverse = 275 // Affects bar history limit. Default value 275.
const int maxRetestLabels = 100
const int maxSupports = 3
const int maxResistances = 3
const int debug_maxPivotLabels = 25
const int maxDistanceToLastBar = 450 // Affects Running Time

insideSession = (bar_index > last_bar_index - maxDistanceToLastBar)

// _____ INPUTS _____


resistanceSupportCount = input.int(3, "Support & Resistance Count", options = [1,
2, 3], group = "General Configuration", display = display.none)
pivotRange = input.int(15, "Pivot Range", options = [5, 15, 30], tooltip =
"Increase for more general pivots, decrease for more private pivots.", group =
"General Configuration", display = display.none)
strength = input.int(1, "Strength", options = [1, 2, 3, 4], tooltip = "X many times
price touched relative price area in order to be considered a support/resistance
zone.", group = "General Configuration", display = display.none)
invalidationType = input.string("Close", "Invalidation", options = ["Close",
"Wick"], group = "General Configuration", display = display.none)
expandLines = input.bool(true, "Expand Lines & Zones", group = "General
Configuration", display = display.none)

enableZones = input.bool(false, "Enable Zones", group = "Support & Resistance


Zones", display = display.none)
zoneWidthType = input.string("Dynamic", "Zone Width Type", options = ["Fixed",
"Dynamic"], group = "Support & Resistance Zones", display = display.none)
zoneWidth = input.int(1, "Fixed Zone Width", options = [1, 2, 3], group = "Support
& Resistance Zones", display = display.none)

timeframe1Enabled = input.bool(true, title = "", group = "Timeframes", inline =


"timeframe1", display = display.none)
timeframe1 = input.timeframe("", title = "", group = "Timeframes", inline =
"timeframe1", display = display.none)
timeframe2Enabled = input.bool(false, title = "", group = "Timeframes", inline =
"timeframe2", display = display.none)
timeframe2 = input.timeframe("15", title = "", group = "Timeframes", inline =
"timeframe2", display = display.none)
timeframe3Enabled = input.bool(false, title = "", group = "Timeframes", inline =
"timeframe3", display = display.none)
timeframe3 = input.timeframe("30", title = "", group = "Timeframes", inline =
"timeframe3", display = display.none)

showBreaks = input.bool(true,"Show Breaks", group = "Breaks & Retests", inline =


"ShowBR", display = display.none)
showRetests = input.bool(true,"Show Retests", group = "Breaks & Retests", inline =
"ShowBR", display = display.none)
avoidFalseBreaks = input.bool(true, "Avoid False Breaks", group = "Breaks &
Retests", display = display.none)
falseBreakoutVolumeThresholdOpt = input.float(0.3, "Break Volume Threshold", minval
= 0.1, maxval = 1.0, step = 0.1, group = "Breaks & Retests", tooltip = "Only taken
into account if Avoid False Breakouts is enabled.\nHigher values mean it's less
likely to be a break.", display = display.none)
inverseBrokenLineColor = input.bool(true, "Inverse Color After Broken", tooltip =
"Needs Show Breaks & Expand Lines option enabled.", group = "Breaks & Retests",
display = display.none)

falseBreakoutVolumeThreshold = falseBreakoutVolumeThresholdOpt * 100.0

lineStyle = input.string("____", "Line Style", ["____", "----", "...."], group =


"Style", display = display.none)
lineWidth = input.int(2, "Line Width", minval = 1, group = "Style", display =
display.none)
supportColor = input.color(#08998180, "Support Color", group = "Style", inline =
"RScolors", display = display.none)
resistanceColor = input.color(#f2364580, "Resistance Color", group = "Style",
inline = "RScolors", display = display.none)
textColor = input.color(#ffffff80, "Text Color", group = "Style", inline =
"RScolors", display = display.none)
labelsAlign = DEBUG ? input.string("Right", "Align Labels", options = ["Right"],
group = "Style", tooltip = "Will only work when zones are disabled.", display =
display.none) : "Right"

enableRetestAlerts = input.bool(true, "Enable Retest Alerts", tooltip = "Needs Show


Retests option enabled.", group = "Alerts", display = display.none)
enableBreakAlerts = input.bool(true, "Enable Break Alerts", group = "Alerts",
display = display.none)

memoryOptimizatonEnabled = input.bool(false, "Enable Memory Optimization", tooltip


= "Enable this option if you encounter memory errors.", group = "Advanced", display
= display.none)
enabledHistory = input.bool(true, "Enable History", group = "Advanced")
// _____ INPUTS END _____

// _____ DEBUG OPTIONS _____


debug_labelPivots = not DEBUG ? "None" : input.string("None", title = "[DBG] Label
Pivots", group = "DEBUG", options = ["All", "RS", "None"], tooltip = "All -> Debugs
all pivot labels.\nRS -> Debugs RS pivot labels.\nNone -> Debugs none of the last
R&S pivots.")
debug_pivotLabelText = not DEBUG ? false : input.bool(false, title = "[DBG] Pivot
Label Text", group = "DEBUG")
debug_showBrokenOnLabel = not DEBUG ? false : input.bool(false, "[DBG] Show Broken
Text On Label", group = "DEBUG")
debug_removeDuplicateRS = not DEBUG ? true : input.bool(true, "[DBG] Remove
Duplicate RS", group = "DEBUG")
debug_lastXResistances = not DEBUG ? 3 : input.int(3, "[DBG] Show Last X
Resistances", minval = 0, maxval = maxResistances, group = "DEBUG")
debug_lastXSupports = not DEBUG ? 3 : input.int(3, "[DBG] Show Last X Supports",
minval = 0, maxval = maxSupports, group = "DEBUG")
debug_maxHistoryRecords = not DEBUG ? 10 : input.int(10, "[DBG] Max History
Records", options = [1, 2, 5, 10, 25], group = "DEBUG")
// _____ DEBUG OPTIONS END _____

atr = ta.atr(30)
createRSLine (color) =>
line.new(na, na, na, na, extend = expandLines ? extend.both : extend.none,
xloc=xloc.bar_time, color = color, width = lineWidth, style = lineStyle == "----" ?
line.style_dashed : lineStyle == "...." ? line.style_dotted : line.style_solid)

createRSBox (color, xlocType) =>


box.new(na, na, na, na, text_size = size.normal, xloc = xlocType, extend =
extend.both, bgcolor = color, text_color = textColor, text_halign = expandLines ?
text.align_right : text.align_center, border_color = #00000000)

createRSLabel () =>
label.new(na, na, "", style = label.style_none, textcolor = textColor)

createBreakLabel (RSType) =>


label.new(na,na,"B",style = RSType == "Resistance" ? label.style_label_up :
label.style_label_down, color=color.blue, textcolor = color.white, xloc =
xloc.bar_time, size = size.small)

createRetestLabel (RSType) =>


label.new(na,na,"R",style = RSType == "Resistance" ? label.style_label_down :
label.style_label_up, color = RSType == "Resistance" ? resistanceColor :
supportColor, textcolor = color.white, xloc = xloc.bar_time, size = size.small)

moveLine(_line, _x, _y, _x2) =>


line.set_xy1(_line, _x, _y)
line.set_xy2(_line, _x2, _y)

moveBox (_box, _topLeftX, _topLeftY, _bottomRightX, _bottomRightY) =>


box.set_lefttop(_box, _topLeftX, _topLeftY)
box.set_rightbottom(_box, _bottomRightX, _bottomRightY)

moveRSInfoBox (_box, _startPointX, _price, _endPointX) =>


zoneWidthPercent = zoneWidth == 1 ? 0.05 : zoneWidth == 2 ? 0.06 : 0.075
if zoneWidthType == "Dynamic"
zoneWidthPercent := ((atr) / _price) * 100 / 3.0
topY = _price * (1.0 + (zoneWidthPercent / 2.0 / 100.0))
bottomY = _price * (1.0 - (zoneWidthPercent / 2.0 / 100.0))
moveBox(_box, _startPointX, topY, _endPointX, bottomY)

// _____ TYPES _____

type customPoint
int t
float price

type RSInfo
bool isBroken = na
int brokenTime = na
string RSType = na
float price = na
line line = na
box box = na
label priceLabel = na
customPoint[] points = na
label[] debugPoints = na
label breakLabel = na
label[] retestLabels = na
line breakLine = na
box breakBox = na

curTR = ta.tr(true)
lowPivot = ta.pivotlow(low, pivotRange, pivotRange)
highPivot = ta.pivothigh(high, pivotRange, pivotRange)
pivotTime = time[pivotRange]

newRSInfo (RSType) =>


newRSInfoF = RSInfo.new()
newRSInfoF.RSType := RSType
newRSInfoF.price := na
newRSInfoF.isBroken := false
newRSInfoF.brokenTime := na

newRSInfoF.line := enableZones ? na : createRSLine(RSType == "Resistance" ?


resistanceColor : supportColor)
newRSInfoF.box := enableZones ? createRSBox(RSType == "Resistance" ?
resistanceColor : supportColor, xloc.bar_time) : na
newRSInfoF.priceLabel := enableZones ? na : createRSLabel()
newRSInfoF.points := array.new<customPoint>(0)
newRSInfoF.debugPoints := array.new<label>(0)
newRSInfoF.retestLabels := array.new<label>(0)
newRSInfoF.breakLabel := na
newRSInfoF.breakLine := na
newRSInfoF.breakBox := na

newRSInfoF

histRSInfo (RSInfo RSInfoF) =>


RSType = RSInfoF.RSType
newRS = RSInfo.new()
newRS.RSType := RSType
newRS.price := RSInfoF.price

newRS.debugPoints := array.new<label>(0)
newRS.retestLabels := array.new<label>(0)
newRS.points := array.new<customPoint>(0)

histText = "History | " + str.tostring(newRS.price, format.mintick)

startTime = math.min(time, RSInfoF.points.get(RSInfoF.points.size() - 1).t)


endTime = RSInfoF.isBroken ? RSInfoF.brokenTime : time

if enableZones
newRS.box := createRSBox(RSType == "Resistance" ? resistanceColor :
supportColor, xloc.bar_time)
moveRSInfoBox(newRS.box, startTime, newRS.price, endTime)
box.set_extend(newRS.box, expandLines ? extend.both : extend.none)
box.set_text(newRS.box, histText)
else
newRS.line := line.copy(RSInfoF.line)
moveLine(newRS.line, startTime, newRS.price, endTime)
line.set_extend(newRS.line, expandLines ? extend.both : extend.none)

newRS.priceLabel := label.copy(RSInfoF.priceLabel)
label.set_text(newRS.priceLabel, histText)
label.set_xloc(newRS.priceLabel, (startTime + endTime) / 2, xloc.bar_time)

if not na(newRS.breakLabel)
newRS.breakLabel := label.copy(RSInfoF.breakLabel)

newRS

derenderRSInfo (RSInfo RSInfoF) =>


if not na(RSInfoF)
line.delete(RSInfoF.line)
box.delete(RSInfoF.box)
label.delete(RSInfoF.priceLabel)

if RSInfoF.debugPoints.size() > 0
for i = 0 to RSInfoF.debugPoints.size() - 1
label.delete(RSInfoF.debugPoints.get(i))

if RSInfoF.retestLabels.size() > 0
for i = 0 to RSInfoF.retestLabels.size() - 1
label.delete(RSInfoF.retestLabels.get(i))

label.delete(RSInfoF.breakLabel)
line.delete(RSInfoF.breakLine)
box.delete(RSInfoF.breakBox)

safeDeleteRSInfo (RSInfo RSInfoF) =>


if not na(RSInfoF)
derenderRSInfo(RSInfoF)
RSInfoF.points.clear()
RSInfoF.debugPoints.clear()
RSInfoF.retestLabels.clear()

type timeframeInfo
int index = na
string timeframeStr = na
bool isEnabled = false

RSInfo[] resistances = na
RSInfo[] supports = na

float[] highPivots = na
float[] highTRs = na
int[] highTimes = na

float[] lowPivots = na
float[] lowTRs = na
int[] lowTimes = na

newTimeframeInfo (index, timeframeStr, isEnabled) =>


newTFInfo = timeframeInfo.new()
newTFInfo.index := index
newTFInfo.isEnabled := isEnabled
newTFInfo.timeframeStr := timeframeStr

newTFInfo.resistances := array.new<RSInfo>(debug_lastXResistances)
newTFInfo.supports := array.new<RSInfo>(debug_lastXSupports)

newTFInfo.highPivots := array.new<float>()
newTFInfo.highTRs := array.new<float>()
newTFInfo.highTimes := array.new<int>()

newTFInfo.lowPivots := array.new<float>()
newTFInfo.lowTRs := array.new<float>()
newTFInfo.lowTimes := array.new<int>()

newTFInfo

// _____ TYPES END _____

// _____ VARS _____

var timeframeInfo[] timeframeInfos = array.from(newTimeframeInfo(1, timeframe1,


timeframe1Enabled), newTimeframeInfo(2, timeframe2, timeframe2Enabled),
newTimeframeInfo(3, timeframe3, timeframe3Enabled))
var bool initRun = true

var float[] allLowPivots = array.new<float>(0)


var float[] allHighPivots = array.new<float>(0)

var int[] allLowTimes = array.new<int>(0)


var int[] allHighTimes = array.new<int>(0)

var float[] allHighTR = array.new<float>(0)


var float[] allLowTR = array.new<float>(0)

var RSInfo[] history = array.new<RSInfo>(0)

RSInfo[] curRSList = array.new<RSInfo>(0)


RSInfo[] oldRSList = array.new<RSInfo>(0)

int maxPivotsAllowed = memoryOptimizatonEnabled ? 7 : 15 // Affects memory limit.


Default value 15.

// _____ VARS END _____

doValuesTouch (float value1, float value2, float tr) =>


if math.abs(value1 - value2) <= tr * touchATR
true
else
false

doValuesTouch (float value1, float value2, float tr, float customATRRatio) =>
if math.abs(value1 - value2) <= tr * customATRRatio
true
else
false

findLatestRS (timeframeInfo timeframeInfoF, string RSType, pivots, times, trs,


bannedValues) =>
RSInfo latestRSF = na
pivotsCount = pivots.size()
if pivotsCount > 0
for i = 0 to pivotsCount - 1
if i >= maxTraverse
break

index = pivotsCount - i - 1
occurances = 0
invalidValue = false
pivotValue1 = pivots.get(index)
if bannedValues.size() > 0
for a = 0 to bannedValues.size() - 1
if doValuesTouch(pivotValue1, bannedValues.get(a),
trs.get(index))
invalidValue := true
break

if invalidValue
continue

for j = 0 to pivotsCount - 1
if j >= maxTraverse
break

index2 = pivotsCount - j - 1
pivotValue2 = pivots.get(index2)
if doValuesTouch(pivotValue1, pivotValue2, trs.get(index))
occurances += 1

if occurances >= strength


latestRSF := newRSInfo(RSType)
latestRSF.price := pivotValue1
break

if math.abs(index - index2) > maxPivotsBackSR * strength


break

if not na(latestRSF)
break

if not na(latestRSF)
cnt = 0
if pivotsCount > 0
for i = 0 to pivotsCount - 1
if i >= maxTraverse
break

index = pivotsCount - i - 1
pivotValue = pivots.get(index)
if doValuesTouch(pivotValue, latestRSF.price, trs.get(index))
labelTime = times.get(index)
latestRSF.points.push(customPoint.new(labelTime, pivotValue))
cnt += 1
if cnt == strength
break

if not (debug_labelPivots == "None")


if not (debug_labelPivots == "All")
if not na(latestRSF)
cnt = 0
if pivotsCount > 0
for i = 0 to pivotsCount - 1
index = pivotsCount - i - 1
pivotValue = pivots.get(index)
if doValuesTouch(pivotValue, latestRSF.price,
trs.get(index))
labelTime = times.get(index)
latestRSF.debugPoints.push(RSType == "Resistance" ?
label.new(labelTime,pivotValue,text=debug_pivotLabelText ? str.tostring(pivotValue)
: "",xloc=xloc.bar_time, color=resistanceColor, textcolor=color.white) :
label.new(labelTime,pivotValue,text=debug_pivotLabelText ? str.tostring(pivotValue)
: "",xloc=xloc.bar_time, color=supportColor,style = label.style_label_up,
textcolor=color.white))
cnt += 1
if cnt == strength
break
else
if not na(latestRSF)
if pivotsCount > 0
for i = 0 to pivotsCount - 1
index = pivotsCount - i - 1
pivotValue = pivots.get(index)
labelTime = times.get(index)
latestRSF.debugPoints.push(RSType == "Resistance" ?
label.new(labelTime,pivotValue,text=debug_pivotLabelText ? str.tostring(pivotValue)
: "",xloc=xloc.bar_time, color=resistanceColor, textcolor=color.white) :
label.new(labelTime,pivotValue,text=debug_pivotLabelText ? str.tostring(pivotValue)
: "",xloc=xloc.bar_time, color=supportColor,style = label.style_label_up,
textcolor=color.white))
if latestRSF.debugPoints.size() > debug_maxPivotLabels
break
latestRSF

findLatestNthRS (timeframeInfo timeframeInfoF, string RSType, pivots, times, trs,


n) =>
float[] bannedValues = array.new<float>()
foundRS = 0
RSInfo foundLatestRS = na
while foundRS < n
foundLatestRS := findLatestRS(timeframeInfoF, RSType, pivots, times, trs,
bannedValues)
if not na(foundLatestRS)
foundRS += 1
bannedValues.push(foundLatestRS.price)
else
break
foundLatestRS

isTimeframeLower (timeframe1F, timeframe2F) =>


timeframe.in_seconds(timeframe1F) < timeframe.in_seconds(timeframe2F)

getMinTimeframe (timeframe1F, timeframe2F) =>


if isTimeframeLower(timeframe1F, timeframe2F)
timeframe1F
else
timeframe2F

getMaxTimeframe (timeframe1F, timeframe2F) =>


if isTimeframeLower(timeframe1F, timeframe2F)
timeframe2F
else
timeframe1F

getFirstBreak (RSInfo rsInfo) =>


if na(rsInfo)
[na, na]

curIndex = 0
float foundBreakLevel = na
int foundBreakTime = na
float foundBreakTR = na

while true
if curIndex >= maxTraverse
break

oldPriceRes = (invalidationType == "Close" ? close[curIndex + 1] :


high[curIndex + 1])
newPriceRes = (invalidationType == "Close" ? close[curIndex] :
high[curIndex])
oldPriceSup = (invalidationType == "Close" ? close[curIndex + 1] :
low[curIndex + 1])
newPriceSup = (invalidationType == "Close" ? close[curIndex] :
low[curIndex])

isBarBreak = (rsInfo.RSType == "Resistance" ? (oldPriceRes <= rsInfo.price


and newPriceRes > rsInfo.price) : (oldPriceSup >= rsInfo.price and newPriceSup <
rsInfo.price))
if isBarBreak
isTrueBreakout = true
if avoidFalseBreaks
shortTerm = 2
longTerm = 15

shortSum = 0.0
longSum = 0.0

for i = 0 to shortTerm
shortSum += volume[curIndex + i]

for i = 0 to longTerm
longSum += volume[curIndex + i]

shortVolumeAvg = shortSum / shortTerm


longVolumeAvg = longSum / longTerm

volumeRatio = ((shortVolumeAvg - longVolumeAvg) / longVolumeAvg) *


100.0
isTrueBreakout := (volumeRatio >= falseBreakoutVolumeThreshold)

if isTrueBreakout
foundBreakLevel := rsInfo.RSType == "Resistance" ? low[curIndex] :
high[curIndex]
foundBreakTime := time[curIndex]
foundBreakTR := high[curIndex] - low[curIndex]

curIndex += 1
if time[curIndex] <= rsInfo.points.get(rsInfo.points.size() - 1).t
break
[foundBreakLevel, foundBreakTime, foundBreakTR]

getRetests (RSInfo rsInfo) =>


if na(rsInfo)
[na,na]

curIndex = 0
lastRetestIndex = -999
int[] retestTimes = array.new<int>()
float[] retestLevels = array.new<float>()
float[] retestTRs = array.new<float>()

while true
if curIndex >= maxTraverse
break
if retestLevels.size() == maxRetestLabels
break
if rsInfo.isBroken and time[curIndex] >= rsInfo.brokenTime
curIndex += 1
continue

tr = high[curIndex] - low[curIndex]
isRetest = (rsInfo.RSType == "Resistance" ? (doValuesTouch(rsInfo.price,
close[curIndex], tr, retestATR) or doValuesTouch(rsInfo.price, high[curIndex], tr,
retestATR)) : (doValuesTouch(rsInfo.price, close[curIndex], tr, retestATR) or
doValuesTouch(rsInfo.price, low[curIndex], tr, retestATR)))
if isRetest and curIndex - lastRetestIndex >= retestLabelEveryXBars
retestLevels.push(rsInfo.RSType == "Resistance" ? high[curIndex] :
low[curIndex])
retestTimes.push(time[curIndex])
retestTRs.push(high[curIndex] - low[curIndex])
lastRetestIndex := curIndex
curIndex += 1
if time[curIndex] <= rsInfo.points.get(rsInfo.points.size() - 1).t
break
[retestLevels, retestTimes, retestTRs]

formatTimeframeString (formatTimeframe) =>


timeframeF = formatTimeframe == "" ? timeframe.period : formatTimeframe

if str.contains(timeframeF, "D") or str.contains(timeframeF, "W") or


str.contains(timeframeF, "S") or str.contains(timeframeF, "M")
timeframeF
else
seconds = timeframe.in_seconds(timeframeF)
if seconds >= 3600
hourCount = int(seconds / 3600)
str.tostring(hourCount) + " Hour" + (hourCount > 1 ? "s" : "")
else
timeframeF + " Min"

handleRSInfo (timeframeInfo timeframeInfoF, RSInfo RSInfoF, int index, string


RSType) =>
if not na(RSInfoF)
if not na(timeframeInfoF)
curRSList.push(RSInfoF)

[foundBreakLevel, foundBreakTime, foundBreakTR] = getFirstBreak(RSInfoF)

RSInfoF.isBroken := na(foundBreakLevel) ? false : true


RSInfoF.brokenTime := na(foundBreakLevel) ? na : foundBreakTime

if not na(foundBreakLevel)
if showBreaks
if na(RSInfoF.breakLabel)
RSInfoF.breakLabel := createBreakLabel(RSInfoF.RSType)
label.set_xy(RSInfoF.breakLabel, foundBreakTime, foundBreakLevel +
(RSInfoF.RSType == "Resistance" ? (-foundBreakTR / labelOffsetY) : foundBreakTR /
labelOffsetY))

if expandLines
if na(RSInfoF.breakLine) and enableZones == false
RSInfoF.breakLine := createRSLine(color.black)

if na(RSInfoF.breakBox) and enableZones == true


RSInfoF.breakBox := createRSBox(color.black, xloc.bar_time)

if not enableZones
line.set_extend(RSInfoF.breakLine, extend.right)
else
box.set_extend(RSInfoF.breakBox, extend.right)

if inverseBrokenLineColor and showBreaks


if not enableZones
line.set_color(RSInfoF.breakLine, RSInfoF.RSType ==
"Resistance" ? supportColor : resistanceColor)
else
box.set_bgcolor(RSInfoF.breakBox, RSInfoF.RSType ==
"Resistance" ? supportColor : resistanceColor)
else
if not enableZones
line.set_color(RSInfoF.breakLine, RSInfoF.RSType ==
"Resistance" ? resistanceColor : supportColor)
else
box.set_bgcolor(RSInfoF.breakBox, RSInfoF.RSType ==
"Resistance" ? resistanceColor : supportColor)

if showRetests
[retestLevels, retestTimes, retestTRs] = getRetests(RSInfoF)

if not na(retestLevels) and retestLevels.size() > 0


for i = 0 to retestLevels.size() - 1
newRetestLabel = createRetestLabel(RSInfoF.RSType)
label.set_xy(newRetestLabel, retestTimes.get(i),
retestLevels.get(i) + (RSInfoF.RSType == "Support" ? (-retestTRs.get(i) /
labelOffsetY) : retestTRs.get(i) / labelOffsetY))
RSInfoF.retestLabels.push(newRetestLabel)

timeSkipOffset = 0
if enableZones
zoneEndX = time + timeSkipOffset +
timeframe.in_seconds(timeframe.period) * 1000 * labelOffsetsXIndex
startTime = math.min(time, RSInfoF.points.get(RSInfoF.points.size() -
1).t)
moveRSInfoBox(RSInfoF.box, startTime, RSInfoF.price, na(foundBreakTime)
? zoneEndX : foundBreakTime)
moveRSInfoBox(RSInfoF.breakBox, foundBreakTime, RSInfoF.price,
zoneEndX)
else
endTime = time + timeSkipOffset +
timeframe.in_seconds(timeframe.period) * 1000
startTime = math.min(time, RSInfoF.points.get(RSInfoF.points.size() -
1).t)
moveLine(RSInfoF.line, startTime, RSInfoF.price, na(foundBreakTime) ?
endTime : foundBreakTime)
moveLine(RSInfoF.breakLine, foundBreakTime, RSInfoF.price, endTime)
//log.info(str.tostring(RSInfoF.price) + " | " +
str.tostring(RSInfoF.points.get(strength - 1).time) + " = " +
str.tostring(line.get_x1(RSInfoF.line)) + " | " + str.tostring(endTime) + " = " +
str.tostring(line.get_x2(RSInfoF.line)))

if expandLines
if not enableZones
line.set_extend(RSInfoF.line, (na(foundBreakTime)) ? extend.both :
extend.left)
else
box.set_extend(RSInfoF.box, (na(foundBreakTime)) ? extend.both :
extend.left)
else
if not enableZones
line.set_extend(RSInfoF.line, na(foundBreakTime) ? extend.right :
extend.none)
else
box.set_extend(RSInfoF.box, na(foundBreakTime) ? extend.right :
extend.none)

//labelTitleOld = formatTimeframeString(timeframeInfoF.timeframeStr) + " "


+ RSInfoF.RSType + " " + str.tostring(index + 1) + " (" +
str.tostring(RSInfoF.price,format.mintick) + ")" + (RSInfoF.isBroken ? "
[Broken]" : "")
labelTitle = formatTimeframeString(timeframeInfoF.timeframeStr) + " | " +
str.tostring(RSInfoF.price,format.mintick) + ((debug_showBrokenOnLabel and
RSInfoF.isBroken) ? " [B]" : "")

if not enableZones
label.set_text(RSInfoF.priceLabel, enableZones ? "" : labelTitle)
label.set_y(RSInfoF.priceLabel, RSInfoF.price)
else
box.set_text(RSInfoF.box, (RSInfoF.isBroken and expandLines) ? "" :
labelTitle)
box.set_text(RSInfoF.breakBox, labelTitle)

if expandLines or not RSInfoF.isBroken


if not enableZones
if labelsAlign == "Right"
label.set_xloc(RSInfoF.priceLabel, bar_index +
labelOffsetsXIndex, xloc.bar_index)
else
box.set_text_halign(RSInfoF.breakBox, text.align_right)
box.set_text_halign(RSInfoF.box, text.align_right)
else
if not enableZones
label.set_xloc(RSInfoF.priceLabel,
(RSInfoF.points.get(RSInfoF.points.size() - 1).t + RSInfoF.brokenTime) / 2,
xloc.bar_time)
else
box.set_text_halign(RSInfoF.box, text.align_center)
box.set_text_halign(RSInfoF.breakBox, text.align_center)
else
log.error("Couldn't find timeframe " + str.tostring(timeframeInfoF.index) +
" " + str.tostring(index + 1) + "th " + RSType + " . Try decreasing pivot range in
the settings.")

handleTimeframe (timeframeIndex, lowPivots, highPivots, lowTimes, highTimes,


lowTRs, highTRs) =>
timeframeInfoF = timeframeInfos.get(timeframeIndex - 1)
timeframeInfoF.lowPivots.clear()
timeframeInfoF.highPivots.clear()

timeframeInfoF.lowTimes.clear()
timeframeInfoF.highTimes.clear()

timeframeInfoF.lowTRs.clear()
timeframeInfoF.highTRs.clear()

timeframeInfoF.lowPivots := lowPivots
timeframeInfoF.highPivots := highPivots

timeframeInfoF.lowTimes := lowTimes
timeframeInfoF.highTimes := highTimes

timeframeInfoF.lowTRs := lowTRs
timeframeInfoF.highTRs := highTRs

getHigherTFData (timeframeStr) =>


if timeframe.in_seconds() < timeframe.in_seconds(timeframeStr)
request.security(syminfo.tickerid, getMaxTimeframe(timeframe.period,
timeframeStr), [allLowPivots, allHighPivots, allLowTimes, allHighTimes, allLowTR,
allHighTR], calc_bars_count = maxTraverse)
else if timeframe.in_seconds() == timeframe.in_seconds(timeframeStr)
[allLowPivots, allHighPivots, allLowTimes, allHighTimes, allLowTR,
allHighTR]

pushHighPivots (timeframeInfoF, highPivotF, timeF, trF) =>


if not na(highPivotF)
timeframeInfoF.highPivots.push(highPivotF)
timeframeInfoF.highTimes.push(timeF)
timeframeInfoF.highTRs.push(trF)

pushLowPivots (timeframeInfoF, lowPivotF, timeF, trF) =>


if not na(lowPivotF)
timeframeInfoF.lowPivots.push(lowPivotF)
timeframeInfoF.lowTimes.push(timeF)
timeframeInfoF.lowTRs.push(trF)

handleTimeframeIfLower (timeframeInfo timeframeInfoF, highs, lows, int[] timesF,


float[] trsF) =>
if timeframeInfoF.isEnabled and isTimeframeLower(timeframeInfoF.timeframeStr,
timeframe.period)
if not na(highs)
if highs.size() > 0
for i = 0 to highs.size() - 1
timeF = timesF.get(i)
pushHighPivots(timeframeInfoF, highs.get(i), timeF,
trsF.get(i))
if not na(lows)
if lows.size() > 0
for i = 0 to lows.size() - 1
timeF = timesF.get(i)
pushLowPivots(timeframeInfoF, lows.get(i), timeF, trsF.get(i))

getLowerTFData (timeframeStr) =>


if timeframe.in_seconds(timeframeStr) < timeframe.in_seconds()
lowPivots = isTimeframeLower(timeframeStr, timeframe.period) ?
request.security_lower_tf(syminfo.tickerid, getMinTimeframe(timeframeStr,
timeframe.period), ta.pivotlow(low, pivotRange, pivotRange)) : na
highPivots = isTimeframeLower(timeframeStr, timeframe.period) ?
request.security_lower_tf(syminfo.tickerid, getMinTimeframe(timeframeStr,
timeframe.period), ta.pivothigh(high, pivotRange, pivotRange)) : na
times = isTimeframeLower(timeframeStr, timeframe.period) ?
request.security_lower_tf(syminfo.tickerid, getMinTimeframe(timeframeStr,
timeframe.period), pivotTime) : na
trs = isTimeframeLower(timeframeStr, timeframe.period) ?
request.security_lower_tf(syminfo.tickerid, getMinTimeframe(timeframeStr,
timeframe.period), curTR[pivotRange]) : na
[lowPivots, highPivots, times, times, trs, trs]
else
[na, na, na, na, na, na]

getTFData (timeframeStr, tfEnabled) =>


if insideSession and tfEnabled
if isTimeframeLower(timeframeStr, timeframe.period)
getLowerTFData(timeframeStr)
else
getHigherTFData(timeframeStr)
else
[na, na, na, na, na, na]

checkIfRSAreSame (RSInfo rsInfo1, RSInfo rsInfo2) =>


if na(rsInfo1) or na(rsInfo2)
false
else if rsInfo1.RSType != rsInfo2.RSType
false
else if rsInfo1.price != rsInfo2.price
false
else
true

checkIfArrHasRS (RSInfo[] arr, RSInfo rsInfoF) =>


if na(arr) or na(rsInfoF)
true
else if arr.size() == 0
false
else
foundRS = false
for i = 0 to arr.size() - 1
arrRS = arr.get(i)
if checkIfRSAreSame(arrRS, rsInfoF)
foundRS := true
break
if foundRS
true
else
false

clearTimeframeRS (timeframeInfoF) =>


oldRetestsCount = 0
oldBreaksCount = 0

if timeframeInfoF.resistances.size() > 0
for j = 0 to timeframeInfoF.resistances.size() - 1
RSInfo RSInfoF = timeframeInfoF.resistances.get(j)
if not na(RSInfoF)
if enabledHistory
if checkIfArrHasRS(oldRSList, RSInfoF) == false
oldRSList.push(RSInfoF)

oldRetestsCount += RSInfoF.retestLabels.size()
oldBreaksCount += RSInfoF.isBroken ? 1 : 0
derenderRSInfo(RSInfoF)

if timeframeInfoF.supports.size() > 0
for j = 0 to timeframeInfoF.supports.size() - 1
RSInfo RSInfoF = timeframeInfoF.supports.get(j)
if not na(RSInfoF)
if enabledHistory
if checkIfArrHasRS(history, RSInfoF) == false
oldRSList.push(RSInfoF)

oldRetestsCount += RSInfoF.retestLabels.size()
oldBreaksCount += RSInfoF.isBroken ? 1 : 0
derenderRSInfo(RSInfoF)

timeframeInfoF.resistances.clear()
timeframeInfoF.supports.clear()
[oldRetestsCount, oldBreaksCount]

findTimeframeRS (timeframeInfoF, RSType, arr, count, pivots, times, trs) =>


curRetestsCount = 0
curBreaksCount = 0

if count > 0
for j = 0 to count - 1
foundRS = findLatestNthRS(timeframeInfoF, RSType, pivots, times, trs, j
+ 1)
if not na(foundRS)
notDuplicate = true
for a = 0 to timeframeInfos.size() - 1
aInfo = timeframeInfos.get(a)
if na(aInfo) or aInfo.isEnabled == false
continue
otherTimeframeArray = (RSType == "Resistance" ?
aInfo.resistances : aInfo.supports)
if otherTimeframeArray.size() > 0
for b = 0 to otherTimeframeArray.size() - 1
if checkIfRSAreSame(foundRS,
otherTimeframeArray.get(b))
notDuplicate := false
break
if notDuplicate == false
break

if notDuplicate or not debug_removeDuplicateRS


arr.push(foundRS)

if arr.size() > 0
for j = 0 to arr.size() - 1
curRS = arr.get(j)
if not na(curRS)
handleRSInfo(timeframeInfoF, curRS, j, RSType)
curRetestsCount += curRS.retestLabels.size()
curBreaksCount += curRS.isBroken ? 1 : 0
[curRetestsCount, curBreaksCount]

//#region Pivots
if insideSession
if not na(lowPivot)
allLowPivots.push(lowPivot)
allLowTimes.push(pivotTime)
allLowTR.push(curTR[pivotRange])
if allLowPivots.size() > maxPivotsAllowed
allLowPivots.remove(0)
allLowTimes.remove(0)
allLowTR.remove(0)

if not na(highPivot)
allHighPivots.push(highPivot)
allHighTimes.push(pivotTime)
allHighTR.push(curTR[pivotRange])
if allHighPivots.size() > maxPivotsAllowed
allHighPivots.remove(0)
allHighTimes.remove(0)
allHighTR.remove(0)
//#endregion

[lowPivotsTF1, highPivotsTF1, lowTimesTF1, highTimesTF1, lowTRsTF1, highTRsTF1] =


getTFData(timeframe1, timeframe1Enabled)
handleTimeframeIfLower(timeframeInfos.get(0), highPivotsTF1, lowPivotsTF1,
highTimesTF1, highTRsTF1)

[lowPivotsTF2, highPivotsTF2, lowTimesTF2, highTimesTF2, lowTRsTF2, highTRsTF2] =


getTFData(timeframe2, timeframe2Enabled)
handleTimeframeIfLower(timeframeInfos.get(1), highPivotsTF2, lowPivotsTF2,
highTimesTF2, highTRsTF2)

[lowPivotsTF3, highPivotsTF3, lowTimesTF3, highTimesTF3, lowTRsTF3, highTRsTF3] =


getTFData(timeframe3, timeframe3Enabled)
handleTimeframeIfLower(timeframeInfos.get(2), highPivotsTF3, lowPivotsTF3,
highTimesTF3, highTRsTF3)

//plot(nz(na,timeframeInfos.get(0).highPivots.size() > 0 ?
timeframeInfos.get(0).highPivots.get(timeframeInfos.get(0).highPivots.size() - 1) :
0), color = color.blue, title = "High Pivots")
//plot(nz(na,timeframeInfos.get(0).lowPivots.size() > 0 ?
timeframeInfos.get(0).lowPivots.get(timeframeInfos.get(0).lowPivots.size() - 1) :
0), color = color.fuchsia, title = "Low Pivots")

if barstate.islastconfirmedhistory or (barstate.islast and (barstate.isnew or


barstate.isconfirmed))
if timeframe1Enabled and not isTimeframeLower(timeframe1, timeframe.period)
handleTimeframe(1, lowPivotsTF1, highPivotsTF1, lowTimesTF1, highTimesTF1,
lowTRsTF1, highTRsTF1)

if timeframe2Enabled and not isTimeframeLower(timeframe2, timeframe.period)


handleTimeframe(2, lowPivotsTF2, highPivotsTF2, lowTimesTF2, highTimesTF2,
lowTRsTF2, highTRsTF2)

if timeframe3Enabled and not isTimeframeLower(timeframe3, timeframe.period)


handleTimeframe(3, lowPivotsTF3, highPivotsTF3, lowTimesTF3, highTimesTF3,
lowTRsTF3, highTRsTF3)
int enabledTimeframeCount = 0
for i = 0 to timeframeCount - 1
timeframeInfo curInfo = timeframeInfos.get(i)
if curInfo.isEnabled
enabledTimeframeCount += 1

int oldRetestsCount = 0
int curRetestsCount = 0

int oldBreaksCount = 0
int curBreaksCount = 0

for i = 0 to timeframeCount - 1
timeframeInfo curInfo = timeframeInfos.get(i)
if not curInfo.isEnabled
continue

[oldRetests, oldBreaks] = clearTimeframeRS(curInfo)


oldRetestsCount += oldRetests
oldBreaksCount += oldBreaks

resistanceCount = math.min(DEBUG ? debug_lastXResistances :


resistanceSupportCount, maxResistances - (enabledTimeframeCount > 1 ? 1 : 0))
resistanceCount := math.max(resistanceCount, 0)

supportCount = math.min(DEBUG ? debug_lastXSupports :


resistanceSupportCount, maxSupports - (enabledTimeframeCount > 1 ? 1 : 0))
supportCount := math.max(supportCount, 0)

[curRetests1, curBreaks1] = findTimeframeRS(curInfo, "Resistance",


curInfo.resistances, resistanceCount, curInfo.highPivots, curInfo.highTimes,
curInfo.highTRs)
[curRetests2, curBreaks2] = findTimeframeRS(curInfo, "Support",
curInfo.supports, supportCount, curInfo.lowPivots, curInfo.lowTimes,
curInfo.lowTRs)
curRetestsCount += curRetests1 + curRetests2
curBreaksCount += curBreaks1 + curBreaks2

if enabledHistory
historyIndexesToDelete = array.new<int>(0)
if history.size() > 0
for i = 0 to history.size() - 1
if checkIfArrHasRS(curRSList, history.get(i))
historyIndexesToDelete.push(i)

if historyIndexesToDelete.size() > 0
for i = 0 to historyIndexesToDelete.size() - 1
deleteIndex =
historyIndexesToDelete.get(historyIndexesToDelete.size() - i - 1)
safeDeleteRSInfo(history.get(deleteIndex))
history.remove(deleteIndex)

if oldRSList.size() > 0
for i = 0 to oldRSList.size() - 1
curRS = oldRSList.get(i)
if checkIfArrHasRS(curRSList, curRS) == false
history.push(histRSInfo(curRS))
if history.size() > debug_maxHistoryRecords
safeDeleteRSInfo(history.get(0))
history.remove(0)

if oldRSList.size() > 0
for i = 0 to oldRSList.size() - 1
safeDeleteRSInfo(oldRSList.get(i))

curRSList.clear()
oldRSList.clear()

if DEBUG
log.info("History Size : " + str.tostring(history.size()))
log.info("Label Count : " + str.tostring(label.all.size()))
log.info("Line Count : " + str.tostring(line.all.size()))
log.info("Box Count : " + str.tostring(box.all.size()))

if enableRetestAlerts and curRetestsCount > oldRetestsCount and initRun ==


false
alert("New Retests Occured.")

if enableBreakAlerts and curBreaksCount > oldBreaksCount and initRun == false


alert("New Breaks Occured.")

initRun := false

///////////////////////////////////////////////////////////////////////////////////
///////////////

//@version=5

//indicator(title='Super Guppy R1.2 by JustUncleL', shorttitle='SuperGuppy',


overlay=true)

//
// Author: JustUncleL
// Revision: R1.2
// Date: 6-Jan-2018
//
// Description:
// ============
// This indicator is a Super Guppy version of standard Guppy GMMA as used in
// "CM_GUPPY_EMA Revised R2 by JustUncleL". Guppy is designed to capture the
// inferred behaviour of traders and investors by using two groups of averages.
// In this version of Super Guppy Traders Group of EMAs are:
// EMA3 to EMA23 step 2 (Aqua=Uptrend, Blue=downtrend)
// and Investors Group EMAs are:
// EMA25 to EMA70 step 3 (Lime=Uptrend, Red=downtrend)
// (Gray=Trend not established or in a Pull Back).
//
// The idea of Guppy EMAs is to use fractal repetitions to identify points of
// agreement and disagreement which precede significant trend changes.
// For further info on how Guppy/Super Guppy can be used in trading please refer
to
// http://www.guppytraders.com/gup329.shtml
// and many other articles available on the subject.
//
// This indicator provides the following :
// - Swing Arrow Alerts (Red for Sell and Green for Buy) to indicate PullBack
entries
// after new trend has been established. Also have option to wait for both fast
and
// slow to completely seperate (Confluence). Another option is to show alerts
// when show arrows when Candle colour changes, this is handy when using Heikin
Ashi
// or Renko Charts.
// - Trend Break Arrow Alerts (Blue for Sell and Aqua for Buy) to indicate entries
// for agressive trend swing point and is calculated by cross over of the
// average Traders EMA with the average Investors EMA. This was suggested option
// by Guppy himself.
// - Anchor time frame (0=current). This is the time frame that the Guppy MAs are
// calculated for. This way 60 Guppy can be viewed on a 15 min chart to
establish
// tighter Stop Loss conditions.
// - Alert conditions are also created for the TradingView Alarm subsystem. Only
// alerts for the selected alert options are generated.
//
// References:
// ===========
// - Based on Daryl Guppy GMMA and
// CM GMMA Original - https://www.tradingview.com/v/3rxOtFe0/
// - http://www.guppytraders.com/gup329.shtml
//
//
// Revisions:
// ==========
// R1 - Original Version
//
// R1.1 - Some changes to limit the number of Alerts that occur close together.
//
// 13-Jan-2018
// - Fix bug in Anchor calculations when chart Time frame not intraday.
// - Fix bug in Break Arrow calculation, stop signal when Investor MAs
// not change direction yet.
// - Change Traders group to start colouring before Investors Group,
// rather than together.
//
// R1.2 14-Feb-2018
// - Fix bug in 1st pullback arrow calculation.
// - Added option to display candle colours relative to Guppy Trend
// indication.
// 06-Apr-2018
// - Change Anchor to be based purely on Minutes, so 1 month=30240mins
// (21 trading days), 1 week=7200mins (5 trading days), 1 Day=1440mins.
// This makes it more consistent across intraday and extraday chart
Timeframes.
//
//
// -----------------------------------------------------------------------------
// Copyright 2014 Chris Moody
// Copyright 2018 JustUncleL
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// The GNU General Public License can be found here
// <http://www.gnu.org/licenses/>.
//
// -----------------------------------------------------------------------------
//

// EMA Crossover Script

y = ta.ema(close, 55)
// z = sma(close, 200)

plot(y, title='55', color=color.new(color.yellow, 0), linewidth=3)


// plot(z, title="200", color=white, linewidth=3)

// -----------------------------------------------------------------------------
//
//
// Use Alternate Anchor TF for MAs
anchor = input.int(0, minval=0, maxval=1440, title='Use Alternate Anchor TimeFrame
(0=none, max=1440 (mins,D,W)')
//
src = input(close, title='EMA Source')
ShowBreak = input(true, title='Show Trend Break Arrow Alerts')
ShowSwing = input(true, title='Show Swing Arrow Alerts')
ShowCon = input(false, title='Give Only Fast+Slow Confluence Alerts')
uOCCswing = input(false, title='Add Bar Colour Changes to Swing Alerts')
Lookback = input(6, title='Alert Lookback Length')
ShowAvgs = input(false, title='Show Average Fast and Slow Guppy Curves')
show200 = input(false, title='Show 200 EMA Curve')
emaFilter = input(false, title='Filter Alerts with 200ema')
clrBars = input(false, title='Colour Candles to Guppy Trend state')

//
//Fast EMAs
lenF1 = input.int(3, minval=1, title='Fast EMA 1')
lenF2 = input.int(5, minval=1, title='Fast EMA 2')
lenF3 = input.int(7, minval=1, title='Fast EMA 3')
lenF4 = input.int(9, minval=1, title='Fast EMA 4')
lenF5 = input.int(11, minval=1, title='Fast EMA 5')
lenF6 = input.int(13, minval=1, title='Fast EMA 6')
lenF7 = input.int(15, minval=1, title='Fast EMA 7')
lenF8 = input.int(17, minval=1, title='Fast EMA 8')
lenF9 = input.int(19, minval=1, title='Fast EMA 9')
lenF10 = input.int(21, minval=1, title='Fast EMA 10')
lenF11 = input.int(23, minval=1, title='Fast EMA 11')

//Slow EMAs
lenS1 = input.int(25, minval=1, title='Slow EMA 1')
lenS2 = input.int(28, minval=1, title='Slow EMA 2')
lenS3 = input.int(31, minval=1, title='Slow EMA 3')
lenS4 = input.int(34, minval=1, title='Slow EMA 4')
lenS5 = input.int(37, minval=1, title='Slow EMA 5')
lenS6 = input.int(40, minval=1, title='Slow EMA 6')
lenS7 = input.int(43, minval=1, title='Slow EMA 7')
lenS8 = input.int(46, minval=1, title='Slow EMA 8')
lenS9 = input.int(49, minval=1, title='Slow EMA 9')
lenS10 = input.int(52, minval=1, title='Slow EMA 10')
lenS11 = input.int(55, minval=1, title='Slow EMA 11')
lenS12 = input.int(58, minval=1, title='Slow EMA 12')
lenS13 = input.int(61, minval=1, title='Slow EMA 13')
lenS14 = input.int(64, minval=1, title='Slow EMA 14')
lenS15 = input.int(67, minval=1, title='Slow EMA 15')
lenS16 = input.int(70, minval=1, title='Slow EMA 16')

len = input.int(200, minval=1, title='EMA 200 Length')

gold = #FFD700
AQUA = #00FFFFFF
BLUE = #0000FFFF
GRAY = #808080FF

// If have anchor specified, calculate the base multiplier.


mult = timeframe.isintraday ? anchor == 0 or timeframe.multiplier <= 0 or
timeframe.multiplier >= anchor ? 1 : math.round(anchor / timeframe.multiplier) : 1
mult := timeframe.isdwm ? timeframe.isdaily ? anchor == 0 or timeframe.multiplier
<= 0 or timeframe.multiplier >= anchor or anchor <= 1440 ? 1 : math.round(anchor /
1440) : timeframe.isweekly ? anchor == 0 or timeframe.multiplier <= 0 or
timeframe.multiplier >= anchor or anchor <= 7200 ? 1 : math.round(anchor / 7200) :
timeframe.ismonthly ? anchor == 0 or timeframe.multiplier <= 0 or
timeframe.multiplier >= anchor or anchor <= 30240 ? 1 : math.round(anchor /
30240) : 1 : mult

//adjust MA lengths with Anchor Multiplier

//Fast EMA
emaF1 = ta.ema(src, lenF1 * mult)
emaF2 = ta.ema(src, lenF2 * mult)
emaF3 = ta.ema(src, lenF3 * mult)
emaF4 = ta.ema(src, lenF4 * mult)
emaF5 = ta.ema(src, lenF5 * mult)
emaF6 = ta.ema(src, lenF6 * mult)
emaF7 = ta.ema(src, lenF7 * mult)
emaF8 = ta.ema(src, lenF8 * mult)
emaF9 = ta.ema(src, lenF9 * mult)
emaF10 = ta.ema(src, lenF10 * mult)
emaF11 = ta.ema(src, lenF11 * mult)
//average
emafast = (emaF1 + emaF2 + emaF3 + emaF4 + emaF5 + emaF6 + emaF7 + emaF8 + emaF9 +
emaF10 + emaF11) / 11
//
//Slow EMA
emaS1 = ta.ema(src, lenS1 * mult)
emaS2 = ta.ema(src, lenS2 * mult)
emaS3 = ta.ema(src, lenS3 * mult)
emaS4 = ta.ema(src, lenS4 * mult)
emaS5 = ta.ema(src, lenS5 * mult)
emaS6 = ta.ema(src, lenS6 * mult)
emaS7 = ta.ema(src, lenS7 * mult)
emaS8 = ta.ema(src, lenS8 * mult)
emaS9 = ta.ema(src, lenS9 * mult)
emaS10 = ta.ema(src, lenS10 * mult)
emaS11 = ta.ema(src, lenS11 * mult)
emaS12 = ta.ema(src, lenS12 * mult)
emaS13 = ta.ema(src, lenS13 * mult)
emaS14 = ta.ema(src, lenS14 * mult)
emaS15 = ta.ema(src, lenS15 * mult)
emaS16 = ta.ema(src, lenS16 * mult)

// average
emaslow = (emaS1 + emaS2 + emaS3 + emaS4 + emaS5 + emaS6 + emaS7 + emaS8 + emaS9 +
emaS10 + emaS11 + emaS12 + emaS13 + emaS14 + emaS15 + emaS16) / 16
//
//EMA 200
ema200 = ta.ema(src, len * mult)

//Fast EMA Color Rules


colfastL = emaF1 > emaF2 and emaF2 > emaF3 and emaF3 > emaF4 and emaF4 > emaF5 and
emaF5 > emaF6 and emaF6 > emaF7 and emaF7 > emaF8 and emaF8 > emaF9 and emaF9 >
emaF10 and emaF10 > emaF11
colfastS = emaF1 < emaF2 and emaF2 < emaF3 and emaF3 < emaF4 and emaF4 < emaF5 and
emaF5 < emaF6 and emaF6 < emaF7 and emaF7 < emaF8 and emaF8 < emaF9 and emaF9 <
emaF10 and emaF10 < emaF11
//Slow EMA Color Rules
colslowL = emaS1 > emaS2 and emaS2 > emaS3 and emaS3 > emaS4 and emaS4 > emaS5 and
emaS5 > emaS6 and emaS6 > emaS7 and emaS7 > emaS8 and emaS8 > emaS9 and emaS9 >
emaS10 and emaS10 > emaS11 and emaS11 > emaS12 and emaS12 > emaS13 and emaS13 >
emaS14 and emaS14 > emaS15 and emaS15 > emaS16
colslowS = emaS1 < emaS2 and emaS2 < emaS3 and emaS3 < emaS4 and emaS4 < emaS5 and
emaS5 < emaS6 and emaS6 < emaS7 and emaS7 < emaS8 and emaS8 < emaS9 and emaS9 <
emaS10 and emaS10 < emaS11 and emaS11 < emaS12 and emaS12 < emaS13 and emaS13 <
emaS14 and emaS14 < emaS15 and emaS15 < emaS16

//Fast EMA Final Color Rules


colFinal = colfastL and emaS1 > emaS16 ? color.aqua : colfastS and emaS1 < emaS16 ?
color.blue : color.gray
//Slow EMA Final Color Rules
colFinal2 = colslowL ? color.lime : colslowS ? color.red : color.gray

//Fast EMA Plots


p1 = plot(emaF1, title='Fast EMA 1', style=plot.style_line, linewidth=2,
color=colFinal, transp=10)
plot(emaF2, title='Fast EMA 2', style=plot.style_line, linewidth=1, color=colFinal,
transp=10)
//plot(emaF3, title='Fast EMA 3', style=plot.style_line, linewidth=1,
color=colFinal, transp=10)
plot(emaF4, title='Fast EMA 4', style=plot.style_line, linewidth=1, color=colFinal,
transp=10)
//plot(emaF5, title='Fast EMA 5', style=plot.style_line, linewidth=1,
color=colFinal, transp=10)
plot(emaF6, title='Fast EMA 6', style=plot.style_line, linewidth=1, color=colFinal,
transp=10)
//plot(emaF7, title='Fast EMA 7', style=plot.style_line, linewidth=1,
color=colFinal, transp=10)
plot(emaF8, title='Fast EMA 8', style=plot.style_line, linewidth=1, color=colFinal,
transp=10)
//plot(emaF9, title='Fast EMA 9', style=plot.style_line, linewidth=1,
color=colFinal, transp=10)
plot(emaF10, title='Fast EMA 10', style=plot.style_line, linewidth=1,
color=colFinal, transp=10)
p2 = plot(emaF11, title='Fast EMA 11', style=plot.style_line, linewidth=1,
color=colFinal, transp=10)
plot(ShowAvgs ? emafast : na, title='Fast Avg', style=plot.style_circles,
join=true, linewidth=2, color=color.new(gold, 10))
//
fill(p1, p2, color=color.new(color.silver, 95))

//Slow EMA Plots


p33 = plot(emaS1, title='Slow EMA 1', style=plot.style_line, linewidth=2,
color=colFinal2, transp=10)
plot(emaS2, title='Slow EMA 2', style=plot.style_line, linewidth=1,
color=colFinal2, transp=10)
//plot(emaS3, title='Slow EMA 3', style=plot.style_line, linewidth=1,
color=colFinal2, transp=10)
plot(emaS4, title='Slow EMA 4', style=plot.style_line, linewidth=1,
color=colFinal2, transp=10)
//plot(emaS5, title='Slow EMA 5', style=plot.style_line, linewidth=1,
color=colFinal2, transp=10)
plot(emaS6, title='Slow EMA 6', style=plot.style_line, linewidth=1,
color=colFinal2, transp=10)
//plot(emaS7, title='Slow EMA 7', style=plot.style_line, linewidth=1,
color=colFinal2, transp=10)
//plot(emaS8, title='Slow EMA 8', style=plot.style_line, linewidth=1,
color=colFinal2, transp=10)
plot(emaS9, title='Slow EMA 9', style=plot.style_line, linewidth=1,
color=colFinal2, transp=10)
//plot(emaS10, title='Slow EMA 10', style=plot.style_line, linewidth=1,
color=colFinal2, transp=10)
plot(emaS11, title='Slow EMA 11', style=plot.style_line, linewidth=1,
color=colFinal2, transp=10)
//plot(emaS12, title='Slow EMA 12', style=plot.style_line, linewidth=1,
color=colFinal2, transp=10)
//plot(emaS13, title='Slow EMA 13', style=plot.style_line, linewidth=1,
color=colFinal2, transp=10)
//plot(emaS14, title='Slow EMA 14', style=plot.style_line, linewidth=1,
color=colFinal2, transp=10)
//plot(emaS15, title='Slow EMA 15', style=plot.style_line, linewidth=1,
color=colFinal2, transp=10)
p43 = plot(emaS16, title='Slow EMA 16', style=plot.style_line, linewidth=2,
color=colFinal2, transp=10)
plot(ShowAvgs ? emaslow : na, title='Slow Avg', style=plot.style_circles,
join=true, linewidth=2, color=color.new(color.fuchsia, 10))

//
fill(p33, p43, color=color.new(color.silver, 95))

plot(show200 ? ema200 : na, title='EMA 200', style=plot.style_circles, join=true,


linewidth=2, color=color.new(color.black, 10))

//Fast EMA Final Color Rules


c = colfastL and emaS1 > emaS16 ? AQUA : colfastS and emaS1 < emaS16 ? BLUE : GRAY
//barcolor(clrBars ? c : na, title='Guppy Bar Colors')

// Generate Alert Arrows


buy0 = 0
sell0 = 0
buybreak = 0
sellbreak = 0
//
buy0 := emafast > emaslow and emaS1 > emaS16 and not colslowS and colfastL and (not
ShowCon or colslowL) and (not emaFilter or emafast > ema200) ? nz(buy0[1]) > 0 ?
buy0[1] + 1 : 1 : 0
sell0 := emafast < emaslow and emaS1 < emaS16 and not colslowL and colfastS and
(not ShowCon or colslowS) and (not emaFilter or emafast < ema200) ? nz(sell0[1]) >
0 ? sell0[1] + 1 : 1 : 0
buy0 := buy0 > 1 and colfastL and uOCCswing and close[1] < open[1] and close > open
? 1 : buy0
sell0 := sell0 > 1 and colfastS and uOCCswing and close[1] > open[1] and close <
open ? 1 : sell0
//
buybreak := emafast > emaslow and not colslowS and (not emaFilter or emafast >
ema200) ? nz(buybreak[1]) > 0 ? buybreak[1] + 1 : 1 : 0
sellbreak := emafast < emaslow and not colslowL and (not emaFilter or emafast <
ema200) ? nz(sellbreak[1]) > 0 ? sellbreak[1] + 1 : 1 : 0
//
plotarrow(ShowSwing and buy0 == 1 and ta.barssince(nz(buy0[1], 1) == 1) >
Lookback ? 1 : na, title='BUY Swing Arrow', colorup=color.new(color.lime, 20),
maxheight=60, minheight=50)
plotarrow(ShowSwing and sell0 == 1 and ta.barssince(nz(sell0[1], 1) == 1) >
Lookback ? -1 : na, title='SELL Swing Arrow', colordown=color.new(color.red, 20),
maxheight=60, minheight=50)

plotarrow(ShowBreak and buybreak == 1 and ta.barssince(nz(sellbreak[1], 1) == 1) >


Lookback and ta.barssince(nz(buybreak[1], 1) == 1) > Lookback ? 1 : na, title='BUY
Break Arrow', colorup=color.new(color.aqua, 20), maxheight=60, minheight=50)
plotarrow(ShowBreak and sellbreak == 1 and ta.barssince(nz(buybreak[1], 1) == 1) >
Lookback and ta.barssince(nz(sellbreak[1], 1) == 1) > Lookback ? -1 : na,
title='SELL Break Arrow', colordown=color.new(color.blue, 20), maxheight=60,
minheight=50)

// Generate only Alarms that are selected.


gAlert = ShowSwing and (buy0 == 1 and ta.barssince(nz(buy0[1], 1) == 1) > Lookback
or sell0 == 1 and ta.barssince(nz(sell0[1], 1) == 1) > Lookback) or ShowBreak and
(buybreak == 1 or sellbreak == 1) and ta.barssince(nz(buybreak[1], 1) == 1) >
Lookback and ta.barssince(nz(sellbreak[1], 1) == 1) > Lookback
//alertcondition(gAlert, title='Guppy Alert Arrow', message='Guppy Alert')
//alertcondition(ShowSwing and buy == 1 and ta.barssince(nz(buy[1], 1) == 1) >
Lookback or ShowBreak and buybreak == 1 and ta.barssince(nz(buybreak[1], 1) == 1) >
Lookback and ta.barssince(nz(sellbreak[1], 1) == 1) > Lookback, title='Buy Arrow',
message='BUY')
//alertcondition(ShowSwing and sell == 1 and ta.barssince(nz(sell[1], 1) == 1) >
Lookback or ShowBreak and sellbreak == 1 and ta.barssince(nz(buybreak[1], 1) == 1)
> Lookback and ta.barssince(nz(sellbreak[1], 1) == 1) > Lookback, title='Sell
Arrow', message='SELL')

//
//eof

//indicator("VDUB Rejection Spike V3 with VWAP", overlay=true)

// EMA 1
ema1 = ta.ema(src, len)
plot(ema1, title="EMA 1", color=color.white, style=plot.style_line, linewidth=1)

// Candle Body Channel


last8h = ta.highest(close, 13)
lastl8 = ta.lowest(close, 13)
channel2 = input.bool(false, title="Candle Body Channel On/Off")
plot(channel2 ? last8h : na, color=color.black, linewidth=1,
style=plot.style_linebr, title="Candle Body Resistance Level Top")
plot(channel2 ? lastl8 : na, color=color.black, linewidth=1,
style=plot.style_linebr, title="Candle Body Support Level Bottom")

// Resistance Channel 2
channel = input.bool(false, title="Resistance Channel 2 On/Off")
var float up = na
var float down = na
if (close < nz(up[1]) and close > nz(down[1]))
up := nz(up[1])
down := nz(down[1])
else
up := high
down := low
plot(channel ? up : na, color=color.red, linewidth=1, style=plot.style_linebr,
title="Resistance Level Top")
plot(channel ? down : na, color=color.green, linewidth=1, style=plot.style_linebr,
title="Resistance Level Bottom")

// Support and Resistance V0


RST = input.int(title='Support / Resistance length:', defval=21)
RSTT = ta.valuewhen(high >= ta.highest(high, RST), high, 0)
RSTB = ta.valuewhen(low <= ta.lowest(low, RST), low, 0)
plot(RSTT, color=color.red, linewidth=1, title="Resistance Level V0")
plot(RSTB, color=color.green, linewidth=1, title="Support Level V0")

// Fractals
length = input.int(55, title="Fractal Length")
filterFractals = input.bool(true, title="Signal Filter On/Off")
ftop = high[2] > high[3] and high[2] > high[4] and high[2] > high[1] and high[2] >
high[0]
fbot = low[2] < low[3] and low[2] < low[4] and low[2] < low[1] and low[1] < low[0]
topf = ftop and high[2] >= ta.highest(high, length)
botf = fbot and low[2] <= ta.lowest(low, length)
filteredtopf = filterFractals ? topf : ftop
filteredbotf = filterFractals ? botf : fbot
plotshape(filteredtopf, style=shape.triangledown, location=location.abovebar,
color=color.maroon, text="SELL", offset=-1)
plotshape(filteredbotf, style=shape.triangleup, location=location.belowbar,
color=color.green, text="BUY", offset=-1)

// EMA 2 with Two Colors


len0 = input.int(13, minval=1, title="EMA 2 Length")
ema2 = ta.ema(close, len0)
plot_color = ema2 >= ema2[2] ? color.lime : color.red
plot(ema2, title="EMA 2", style=plot.style_line, linewidth=1, color=plot_color)

// VWAP
vwap = ta.vwap(close)
plot(vwap, title="VWAP", color=color.purple, linewidth=2)
////////////
//@version=5
//ndicator('Signals & Overlay Similar', overlay=true, max_labels_count =500)
atrMulti = input.float(3.5, 'Signal Sensitivity', minval=0.1,
step=0.2,group='Sensitivity')

//sensitivity
atrPeriod = input.int (100, 'Smoothing', minval=1, group='Deep Sensitivity')
maPeriod = input.int (6, 'Reactivity', minval=1, group='Deep Sensitivity')
strongest = input(200, title = 'Strong Signal Strength', group='DeepSensitivity')
trendType = input.string('Trailing', 'Trend Calculation Type',options=['Flexible',
'Trailing'], group='Deep Sensitivity')
maType = input.string('SMA', 'Signals Calculation Type', options=['SMA','EMA',
'SMMA', 'LWMA', 'DEMA', 'TEMA', 'HMA', 'LSMA', 'RMA', 'T3'],
group='DeepSensitivity')

sigs = input(true, 'Signal', group='Overlay Future')


lines = input(false, 'Signal Line', group='Overlay Future')
extend = input(false, 'Reverse Signal Count', group='Overlay Future')

confalert = input.string("Off", "Alert Connect", ["Active", "Off"],group="Alert")


alert2 = input.string("Buy Signal", "Signals Alert", ["Buy Signal", "Sell
Signal"],group = "Alert")

// Multi Time Frame Input


mtfResolution = input.timeframe('240', title='Multi-Timeframe
Resolution',group='MTF Settings')

// Main Sensitivity
atrMultiq = input.float(3.5, 'MTF Signal Sensitivity', minval=0.1,
step=0.2,group='MTF Sensitivity')

// Sensitivity
atrPeriodq = input.int (100, 'MTF Smoothing', minval=1, group='MTF
DeepSensitivity')
maPeriodq = input.int (6, 'MTF Reactivity', minval=1, group='MTF DeepSensitivity')
trendTypeq = input.string('Trailing', 'MTF Trend Calculation
Type',options=['Flexible', 'Trailing'], group='MTF Deep Sensitivity')
maTypeq = input.string('SMA', 'Signals Calculation Type', options=['SMA','EMA',
'SMMA', 'LWMA', 'DEMA', 'TEMA', 'HMA', 'LSMA', 'RMA', 'T3'], group='MTF
DeepSensitivity')

// Overlay
sigsq = input(true, 'Multi-Timeframe Signal', group='MTF Overlay Future')
linesq = input(false, 'Multi-Timeframe Signal Line', group='MTF OverlayFuture')

// Helper Functions
ma2(t, sourceq, lengthq) =>maTypeq == 'HMA' ? ta.hma(sourceq, lengthq) :maTypeq
=='EMA' ? ta.ema(sourceq, lengthq) :maTypeq == 'RMA' ?
ta.rma(sourceq,lengthq) :maTypeq == 'SMA' ? ta.sma(sourceq, lengthq) :na
// Moving Averages and ATR Calculations
[maHighq, maLowq] = request.security(syminfo.tickerid, mtfResolution,
[ma2(maTypeq,high, maPeriodq), ma2(maTypeq, low, maPeriodq)])

atrq = request.security(syminfo.tickerid, mtfResolution, ta.atr(atrPeriodq))


*atrMultiq

// Trend Calculations
minLowq = maLowq - atrq
var float upTrendq = na
upTrendq := trendTypeq == 'Flexible' ? minLowq : close[1] > nz(upTrendq[1],minLowq)
? math.max(minLowq, nz(upTrendq[1], minLowq)) : minLowq
plusHighq = maHighq + atrq
var float downTrendq = na
downTrendq := trendTypeq == 'Flexible' ? plusHighq : close[1] <
nz(downTrendq[1],plusHighq) ? math.min(plusHighq, nz(downTrendq[1], plusHighq)) :
plusHighq
var upq = 1
upq := upq != 1 and close > (downTrendq) ? 1 : upq == 1 and close < upTrendq ? -
1 :upq
var downq = 1
downq := downq != 1 and close < (upTrendq) ? 1 : downq == 1 and close >downTrendq ?
-1 : downq

plotSource = plot(close, editable=false, display=display.none)

// Signal Detection
startUpq = upq != upq[1] and upq == 1
plotUpq = plot(upq == 1 and linesq ? upTrendq : na, 'Up', #00ff2a,
1,plot.style_linebr)

startDownq = downq != downq[1] and downq == 1


plotDownq = plot(downq == 1 and linesq ? downTrendq : na, 'Down', #ff0303,
1,plot.style_linebr)
plotshape(startDownq and sigsq ? downTrendq : na,
text='Strong',style=shape.labeldown, location=location.abovebar,
color=color.red,textcolor=color.white, size=size.normal)
plotshape(startUpq and sigsq ? upTrendq : na, text='Strong',
style=shape.labelup,location=location.belowbar, color=color.green,
textcolor=color.white,size=size.normal)
//
//Inputs and Parameters
//Main Sensitivity
// Helper Functions
randwatermark = math.round(math.random(1,3,6))
smma(source, length) =>
var float smma = na
smma := na(smma[1]) ? ta.sma(source, length) : (smma[1] * (length - 1) +
source) / length
smma

lwma(source, length) =>


norm = length * (length + 1) / 2
sum = 0.0
for i = 0 to length - 1
sum := sum + source[i] * (length - i)
sum / norm

dema(source, length) =>


ema1 = ta.ema(source, length)
ema2 = ta.ema(ema1, length)
2 * ema1 - ema2

tema(source, length) =>


ema1 = ta.ema(source, length)
ema2 = ta.ema(ema1, length)
ema3 = ta.ema(ema2, length)
3 * (ema1 - ema2) + ema3

t3(source, length) =>


e1 = ta.ema(source, length)
e2 = ta.ema(e1, length)
e3 = ta.ema(e2, length)
e4 = ta.ema(e3, length)
e5 = ta.ema(e4, length)
e6 = ta.ema(e5, length)
c1 = -0.7 * 0.7 * 0.7
c2 = 3 * 0.7 * 0.7 + 3 * 0.7 * 0.7 * 0.7
c3 = -6 * 0.7 * 0.7 - 3 * 0.7 - 3 * 0.7 * 0.7 * 0.7
c4 = 1 + 3 * 0.7 + 3 * 0.7 * 0.7 + 0.7 * 0.7 * 0.7
t3 = c1 * e6 + c2 * e5 + c3 * e4 + c4 * e3
t3

ma(t, source, length) =>


maType == 'HMA' ? ta.sma(source, length) : maType == 'EMA' ?
ta.ema(source,length) : maType == 'HMA' ? ta.hma(source, length) : maType ==
'RMA' ?ta.rma(source, length) : maType == 'SMA' ? ta.sma(source, length) : maType
=='SMMA' ? smma(source, length) : maType == 'LWMA' ? lwma(source, length) : maType
=='DEMA' ? dema(source, length) : maType == 'TEMA' ? tema(source, length) : maType
=='LSMA' ? ta.linreg(source, length, 0) : maType == 'T3' ? t3(source, length) : na

// Moving Averages and ATR Calculations


maHigh = ma(maType, high, maPeriod)
maLow = ma(maType, low, maPeriod)
atr1 = ta.atr(atrPeriod) * atrMulti

// Trend Calculations
minLow = maLow - atr1
var float upTrend = na
upTrend := trendType == 'Flexible' ? minLow : close[1] > nz(upTrend[1], minLow) ?
math.max(minLow, nz(upTrend[1], minLow)) : minLow

minHigh = maHigh - atr1


var float upRange = na
upRange := trendType == 'Flexible' ? minHigh : close[1] > nz(upRange[1], minHigh) ?
math.max(minHigh, nz(upRange[1], minHigh)) : minHigh

plusHigh = maHigh + atr1

var float downTrend = na


downTrend := trendType == 'Flexible' ? plusHigh : close[1] <
nz(downTrend[1],plusHigh) ? math.min(plusHigh, nz(downTrend[1], plusHigh)) :
plusHigh

plusLow = maLow + atr1


var float downRange = na
downRange := trendType == 'Flexible' ? plusLow : close[1] <
nz(downRange[1],plusLow) ? math.min(plusLow, nz(downRange[1], plusLow)) : plusLow

var up1 = 1
up1 := up1 != 1 and close > (downTrend) ? 1 : up1 == 1 and close < upTrend ? -1 :
up1

var down1 = 1
down1 := down1 != 1 and close < (upTrend) ? 1 : down1 == 1 and close > downTrend ?
-1 : down1

// Signal Detection
startUp = up1 != up1[1] and up1 == 1
plotUp = plot(up1 == 1 and lines ? upTrend : na, 'Up', #00ff2a,
1,plot.style_linebr)
startDown = down1 != down1[1] and down1 == 1
plotDown = plot(down1 == 1 and lines ? downTrend : na, 'Down', #ff0303,
1,plot.style_linebr)

label upLabel = na
var label downLabel = na

if (up1)
if (not na(upLabel))
label.delete(upLabel)
upLabel := label.new(bar_index, up1 == 1 and extend ? upTrend : na, "Reversal
ToSell: " + str.tostring(upTrend, "#.##"),
color=color.red,style=label.style_label_left, textcolor=#ffffff)
if (down1)
if (not na(downLabel))
label.delete(downLabel)
downLabel := label.new(bar_index, down1 == 1 and extend ? downTrend :
na,"Reversal To Buy: " + str.tostring(downTrend, "#.##"),
color=color.green,style=label.style_label_left, textcolor=#ffffff)
// EMA 200 for Signal Differentiation
ema2000 = ta.ema(close, strongest)

plotshape(startDown and sigs and close < ema2000 ? downTrend : na,


text='S+',style=shape.labeldown, location=location.abovebar,
color=color.red,textcolor=#ffffff, size=size.normal)

plotshape(startDown and sigs and close >= ema2000 ? downTrend : na,


text='S',style=shape.labeldown, location=location.abovebar,
color=color.red,textcolor=#ffffff, size=size.normal)

plotshape(startUp and sigs and close > ema2000 ? upTrend : na,


text='B+',style=shape.labelup, location=location.belowbar,
color=color.green,textcolor=#ffffff, size=size.normal)

plotshape(startUp and sigs and close <= ema2000 ? upTrend : na,


text='B',style=shape.labelup, location=location.belowbar,
color=color.green,textcolor=#ffffff, size=size.normal)

// Bar color based on strong signal conditionsbarcolor(upq == 1 ? #00ff08 : na)


barcolor(downq ? #ff0000 : na)

You might also like