Multiple Time Frame Alerts Set on One Time Frame
Posted: Tue Feb 15, 2022 3:03 pm
Hi Pinescripters,
I'm using a modified Ichimoku Cloud script that draws multiple time frames on the chart of one time frame. I would like to apply alerts to one chart, but still have the alert trigger if any conditions are met in other time frames, e.g. set an alert on the daily chart that has weekly or monthly conditions, and the alert triggers if those weekly or monthly conditions are met.
In my current test, I'm trying to get an alert to trigger if the price is in or above the cloud in the weekly time frame (this is a variable that I defined in the script as "PriceInOrAboveSeventhCloud"). If I set this alert on the daily chart, the alert doesn't trigger. If I set this alert on the weekly chart, the alert triggers. This is not what I want the script to do because I want the alert to trigger if I set it on any timeframe.
The end goal is to have an alert that triggers based on a condition in the current time frame, with multiple confirmations from conditions in other time frames being met as well.
Please see the code below and let me know what modifications need to be made. Apologies for the long question and code as I'm new to coding, any help is appreciated!
I'm using a modified Ichimoku Cloud script that draws multiple time frames on the chart of one time frame. I would like to apply alerts to one chart, but still have the alert trigger if any conditions are met in other time frames, e.g. set an alert on the daily chart that has weekly or monthly conditions, and the alert triggers if those weekly or monthly conditions are met.
In my current test, I'm trying to get an alert to trigger if the price is in or above the cloud in the weekly time frame (this is a variable that I defined in the script as "PriceInOrAboveSeventhCloud"). If I set this alert on the daily chart, the alert doesn't trigger. If I set this alert on the weekly chart, the alert triggers. This is not what I want the script to do because I want the alert to trigger if I set it on any timeframe.
The end goal is to have an alert that triggers based on a condition in the current time frame, with multiple confirmations from conditions in other time frames being met as well.
Please see the code below and let me know what modifications need to be made. Apologies for the long question and code as I'm new to coding, any help is appreciated!
Code: Select all
// © anthonyf50
//@version=4
study("MTF Ichimoku", overlay=true)
// ——————————————————————————————————————————————————————————————————————————————————————
// ——————————————————————————————————— CONFIGURATION ———————————————————————————————————
// ——————————————————————————————————————————————————————————————————————————————————————
C00 = "Original", C01 = "Aqua", C02 = "Black", C03 = "Blue", C04 = "Coral", C05 = "Gold", C06 = "Gray", C07 = "Green", C08 = "Lime", C09 = "Maroon", C10 = "Orange", C11 = "Pink", C12 = "Red", C13 = "Violet", C14 = "Yellow", C15 = "White"
_base = input(false, "─────── Base parameters ───────")
conversionPeriods = input(9, minval=1, title="Conversion Line Periods"),
basePeriods = input(26, minval=1, title="Base Line Periods")
laggingSpan2Periods = input(52, minval=1, title="Lagging Span 2 Periods"),
displacement = input(26, minval=1, title="Displacement")
// 1 Minute
isActiveFirst = input(false, "──────── First ichimoku ───────")
FirstIchi = input("1", "► Time frame", type = input.resolution)
isActiveFirstTenkan = input(true, "Tenkan")
isActiveFirstKijun = input(true, "Kijun")
isActiveFirstChikou = input(true, "Chikou")
isActiveFirstKumo = input(true, "Kumo ──────────────")
isActiveFirstMonoKumo = input(true, " ▪ Monochrome")
isActiveFirstLabel = input(true, "Label ──────────────")
labelFirstOffset = input(4, " ▪ Offset", minval = -20, maxval = 20)
labelFirstColor = input(C00, " ▪ Color", options = [C00, C01, C02, C03, C04, C05, C06, C07, C08, C09, C10, C11, C12, C13, C14, C15])
isActiveFirstAbbreviation = input(true, " ▪ Abbreviation")
// 5 Minute
isActiveSecond = input(false, "────── Seconde ichimoku ───────")
SecondIchi = input("5", "► Time frame", type = input.resolution)
isActiveSecondTenkan = input(true, "Tenkan")
isActiveSecondKijun = input(true, "Kijun")
isActiveSecondChikou = input(true, "Chikou")
isActiveSecondKumo = input(true, "Kumo ──────────────")
isActiveSecondMonoKumo = input(true, " ▪ Monochrome")
isActiveSecondLabel = input(true, "Label ──────────────")
labelSecondOffset = input(4, " ▪ Offset", minval = -20, maxval = 20)
labelSecondColor = input(C00, " ▪ Color", options = [C00, C01, C02, C03, C04, C05, C06, C07, C08, C09, C10, C11, C12, C13, C14, C15])
isActiveSecondAbbreviation = input(true, " ▪ Abbreviation")
// 15 Minute
isActiveThird = input(false, "─────── Third ichimoku ────────")
ThirdIchi = input("15", "► Time frame", type = input.resolution)
isActiveThirdTenkan = input(true, "Tenkan")
isActiveThirdKijun = input(true, "Kijun")
isActiveThirdChikou = input(true, "Chikou")
isActiveThirdKumo = input(true, "Kumo ──────────────")
isActiveThirdMonoKumo = input(true, " ▪ Monochrome")
isActiveThirdLabel = input(true, "Label ──────────────")
labelThirdOffset = input(4, " ▪ Offset", minval = -20, maxval = 20)
labelThirdColor = input(C00, " ▪ Color", options = [C00, C01, C02, C03, C04, C05, C06, C07, C08, C09, C10, C11, C12, C13, C14, C15])
isActiveThirdAbbreviation = input(true, " ▪ Abbreviation")
// 30 Minute
isActiveFourth = input(false, "─────── Fourth ichimoku ───────")
FourthIchi = input("30", "► Time frame", type = input.resolution)
isActiveFourthTenkan = input(true, "Tenkan")
isActiveFourthKijun = input(true, "Kijun")
isActiveFourthChikou = input(true, "Chikou")
isActiveFourthKumo = input(true, "Kumo ──────────────")
isActiveFourthMonoKumo = input(true, " ▪ Monochrome")
isActiveFourthLabel = input(true, "Label ──────────────")
labelFourthOffset = input(4, " ▪ Offset", minval = -20, maxval = 20)
labelFourthColor = input(C00, " ▪ Color", options = [C00, C01, C02, C03, C04, C05, C06, C07, C08, C09, C10, C11, C12, C13, C14, C15])
isActiveFourthAbbreviation = input(true, " ▪ Abbreviation")
// 1 Hour
isActiveFifth = input(false, "─────── Fifth ichimoku ────────")
FifthIchi = input("60", "► Time frame", type = input.resolution)
isActiveFifthTenkan = input(true, "Tenkan")
isActiveFifthKijun = input(true, "Kijun")
isActiveFifthChikou = input(true, "Chikou")
isActiveFifthKumo = input(true, "Kumo ──────────────")
isActiveFifthMonoKumo = input(true, " ▪ Monochrome")
isActiveFifthLabel = input(true, "Label ──────────────")
labelFifthOffset = input(4, " ▪ Offset", minval = -20, maxval = 20)
labelFifthColor = input(C00, " ▪ Color", options = [C00, C01, C02, C03, C04, C05, C06, C07, C08, C09, C10, C11, C12, C13, C14, C15])
isActiveFifthAbbreviation = input(true, " ▪ Abbreviation")
// 1 Day
isActiveSixth = input(false, "─────── Sixth ichimoku ────────")
SixthIchi = input("1D", "► Time frame", type = input.resolution)
isActiveSixthTenkan = input(true, "Tenkan")
isActiveSixthKijun = input(true, "Kijun")
isActiveSixthChikou = input(true, "Chikou")
isActiveSixthKumo = input(true, "Kumo ──────────────")
isActiveSixthMonoKumo = input(true, " ▪ Monochrome")
isActiveSixthLabel = input(true, "Label ──────────────")
labelSixthOffset = input(4, " ▪ Offset", minval = -20, maxval = 20)
labelSixthColor = input(C00, " ▪ Color", options = [C00, C01, C02, C03, C04, C05, C06, C07, C08, C09, C10, C11, C12, C13, C14, C15])
isActiveSixthAbbreviation = input(true, " ▪ Abbreviation")
// 1 Week
isActiveSeventh = input(false, "─────── Seventh ichimoku ────────")
SeventhIchi = input("1W", "► Time frame", type = input.resolution)
isActiveSeventhTenkan = input(true, "Tenkan")
isActiveSeventhKijun = input(true, "Kijun")
isActiveSeventhChikou = input(true, "Chikou")
isActiveSeventhKumo = input(true, "Kumo ──────────────")
isActiveSeventhMonoKumo = input(true, " ▪ Monochrome")
isActiveSeventhLabel = input(true, "Label ──────────────")
labelSeventhOffset = input(4, " ▪ Offset", minval = -20, maxval = 20)
labelSeventhColor = input(C00, " ▪ Color", options = [C00, C01, C02, C03, C04, C05, C06, C07, C08, C09, C10, C11, C12, C13, C14, C15])
isActiveSeventhAbbreviation = input(true, " ▪ Abbreviation")
// 1 Month
isActiveEighth = input(false, "─────── Eighth ichimoku ────────")
EighthIchi = input("1M", "► Time frame", type = input.resolution)
isActiveEighthTenkan = input(true, "Tenkan")
isActiveEighthKijun = input(true, "Kijun")
isActiveEighthChikou = input(true, "Chikou")
isActiveEighthKumo = input(true, "Kumo ──────────────")
isActiveEighthMonoKumo = input(true, " ▪ Monochrome")
isActiveEighthLabel = input(true, "Label ──────────────")
labelEighthOffset = input(4, " ▪ Offset", minval = -20, maxval = 20)
labelEighthColor = input(C00, " ▪ Color", options = [C00, C01, C02, C03, C04, C05, C06, C07, C08, C09, C10, C11, C12, C13, C14, C15])
isActiveEighthAbbreviation = input(true, " ▪ Abbreviation")
// ——————————————————————————————————————————————————————————————————————————————————————
// ————————————————————————————————————— CONSTANTS —————————————————————————————————————
// ——————————————————————————————————————————————————————————————————————————————————————
// ————— Ichimoku
tenkanPeriods=conversionPeriods
kijunPeriods=basePeriods
SSBPeriods=laggingSpan2Periods
displacementPeriods=displacement-1
// ————— Styles
colorVeryLightBlue=#B0B7E6
colorLightBlue=#8893D9
colorDarkBlue=#3E4EBD
colorVeryLightGreen=#9AD6B7
colorLightGreen=#59BD89
colorDarkGreen=#327E56
colorVeryLightOrange=#F5D8A0
colorLightOrange=#EEB448
colorDarkOrange=#EB8412
colorVeryLightPink=#E1AEF0
colorLightPink=#CF83E9
colorDarkPink=#B949DE
colorVeryLightViolet=#775582
colorLightViolet=#724980
colorDarkViolet=#590078
transp=80
colorTest1=#A7AEE2
colorTest2=#313E95
// ————— Time
timeOffset=time-time[1]
// ——————————————————————————————————————————————————————————————————————————————————————
// ————————————————————————————————————— FUNCTION ——————————————————————————————————————
// ——————————————————————————————————————————————————————————————————————————————————————
// ————— Converts color choise
f_stringInColor(_color) =>
// _color: color label (string format).
_color == "Aqua" ? #0080FFef :
_color == "Black" ? #000000ef :
_color == "Blue" ? #013BCAef :
_color == "Coral" ? #FF8080ef :
_color == "Gold" ? #CCCC00ef :
_color == "Gray" ? #808080ef :
_color == "Green" ? #008000ef :
_color == "Lime" ? #00FF00ef :
_color == "Maroon" ? #800000ef :
_color == "Orange" ? #FF8000ef :
_color == "Pink" ? #FF0080ef :
_color == "Red" ? #FF0000ef :
_color == "Violet" ? #AA00FFef :
_color == "Yellow" ? #FFFF00ef : #FFFFFFff
// ————— Converts current resolution
f_resolutionInString(_res) =>
// _res: resolution of any TF (in "timeframe.period" string format).
_res == "1" ? "1m" :
_res == "3" ? "3m" :
_res == "5" ? "5m" :
_res == "15" ? "15m" :
_res == "30" ? "30m" :
_res == "45" ? "45m" :
_res == "60" ? "1h" :
_res == "120" ? "2h" :
_res == "180" ? "3h" :
_res == "240" ? "4h" :
_res == "1D" ? "D" :
_res == "1W" ? "W" :
_res == "1M" ? "M" : _res
// ————— Returns the tenkan text
f_getTenkanText(_res, _isAbbreviation) =>
// _res: resolution of any TF (in "timeframe.period" string format).
tf = f_resolutionInString(_res)
_isAbbreviation ? "Tk " + tf : "Tenkan " + tf
// ————— Returns the tenkan text
f_getKijunText(_res, _isAbbreviation) =>
// _res: resolution of any TF (in "timeframe.period" string format).
tf = f_resolutionInString(_res)
_isAbbreviation ? "Kj " + tf : "Kijun " + tf
// ————— Returns the tenkan text
f_getChikouText(_res, _isAbbreviation) =>
// _res: resolution of any TF (in "timeframe.period" string format).
tf = f_resolutionInString(_res)
_isAbbreviation ? "Ck " + tf : "Chikou " + tf
// ————— Converts current "timeframe.multiplier" plus the TF into minutes of type float.
f_resolutionInMinutes() =>
timeframe.multiplier * (
timeframe.isseconds ? 1. / 60. :
timeframe.isminutes ? 1. :
timeframe.isdaily ? 1440. :
timeframe.isweekly ? 10080. :
timeframe.ismonthly ? 43800. : na)
// ————— Returns resolution of _resolution period in minutes.
f_timeFrameResolutionInMinutes(_res) =>
// _res: resolution of any TF (in "timeframe.period" string format).
security(syminfo.tickerid, _res, f_resolutionInMinutes())
// ————— Returns the average number of current chart bars in the given target HTF resolution (this reflects the dataset's history).
f_avgDilationOf(_res) =>
// _res: resolution of any TF (in "timeframe.period" string format).
b = barssince(change(time(_res)))
cumTotal = cum(b == 0 ? b[1] + 1 : 0)
cumCount = cum(b == 0 ? 1 : 0)
round(cumTotal / cumCount)
// ————— Returns the displacement of the resolution
f_getDisplacement(_res) =>
f_avgDilationOf(_res)*displacementPeriods
// ————— Returns average value between lowest and highest
f_avgLH(_len) => avg(lowest(_len), highest(_len))
// ————— Returns f_donchian data
f_donchian(_tf, _src) => security(syminfo.tickerid, _tf, _src, barmerge.gaps_off, barmerge.lookahead_on)
// ————— Returns ichimoku data
f_ichimokuData(_isActive, _tf) =>
_isShow = _isActive and f_timeFrameResolutionInMinutes(_tf) >= f_resolutionInMinutes()
_displacement = _isShow ? f_getDisplacement(_tf) : na
_tenkan = _isShow ? f_donchian(_tf, f_avgLH(tenkanPeriods)) : na
_kijun = _isShow ? f_donchian(_tf, f_avgLH(kijunPeriods)) : na
_chikou = _isShow ? f_donchian(_tf, close) : na
_SSA = _isShow ? avg(_tenkan, _kijun) : na
_SSB = _isShow ? f_donchian(_tf, f_avgLH(SSBPeriods)) : na
_middleKumo = _isShow ? _SSA[0] > _SSB[0] ? _SSA[0] - (abs(_SSA[0]-_SSB[0])/2) : _SSA[0] + (abs(_SSA[0]-_SSB[0])/2) : na
[_displacement, _tenkan, _kijun, _chikou, _SSA, _SSB, _middleKumo]
// ——————————————————————————————————————————————————————————————————————————————————————
// ——————————————————————————————————— FIRST ICHIMOKU ——————————————————————————————————
// ——————————————————————————————————————————————————————————————————————————————————————
[firstDisplacement, firstTenkan, firstKijun, firstChikou, firstSSA, firstSSB, fisrtMiddleKumo] = f_ichimokuData(isActiveFirst, FirstIchi)
// ————— Tenkan
plot(isActiveFirstTenkan ? firstTenkan : na, color=colorLightBlue, title="First Tenkan", linewidth=1)
// ————— Kijun
plot(isActiveFirstKijun ? firstKijun : na, color=colorDarkBlue, title="First Kijun", linewidth=2)
// ————— Chikou
plot(isActiveFirstChikou ? firstChikou : na, offset = -firstDisplacement, color=colorDarkBlue, title="First Chikou")
// ————— SSA + SSB
ssaFirst=plot(isActiveFirstKumo ? firstSSA : na, offset = firstDisplacement, color=colorLightBlue, title="First SSA", linewidth=1)
ssbFirst=plot(isActiveFirstKumo ? firstSSB : na, offset = firstDisplacement, color=colorLightBlue, title="First SSB", linewidth=1)
fill(ssaFirst, ssbFirst, color= isActiveFirstMonoKumo ? colorDarkBlue : (firstSSA > firstSSB ? colorVeryLightBlue : colorDarkBlue), transp=transp, title="First Kumo")
// ——————————————————————————————————————————————————————————————————————————————————————
// ——————————————————————————————————— SECOND ICHIMOKU —————————————————————————————————
// ——————————————————————————————————————————————————————————————————————————————————————
[secondDisplacement, secondTenkan, secondKijun, secondChikou, secondSSA, secondSSB, secondMiddleKumo] = f_ichimokuData(isActiveSecond, SecondIchi)
// ————— Tenkan
plot(isActiveSecondTenkan ? secondTenkan : na, color=colorLightGreen, title="Second Tenkan", linewidth=1)
// ————— Kijun
plot(isActiveSecondKijun ? secondKijun : na, color=colorDarkGreen, title="Second Kijun", linewidth=2)
// ————— Chikou
plot(isActiveSecondChikou ? secondChikou : na, offset = -secondDisplacement, color=colorDarkGreen, title="Second Chikou")
// ————— SSA + SSB
ssaSecond=plot(isActiveSecondKumo ? secondSSA : na, offset = secondDisplacement, color=colorLightGreen, title="Second SSA", linewidth=1)
ssbSecond=plot(isActiveSecondKumo ? secondSSB : na, offset = secondDisplacement, color=colorLightGreen, title="Second SSB", linewidth=1)
fill(ssaSecond, ssbSecond, color= isActiveSecondMonoKumo ? colorDarkGreen : (secondSSA > secondSSB ? colorVeryLightGreen : colorDarkGreen), transp=transp, title="Second Kumo")
// ——————————————————————————————————————————————————————————————————————————————————————
// ——————————————————————————————————— THIRD ICHIMOKU ——————————————————————————————————
// ——————————————————————————————————————————————————————————————————————————————————————
[thirdDisplacement, thirdTenkan, thirdKijun, thirdChikou, thirdSSA, thirdSSB, thirdMiddleKumo] = f_ichimokuData(isActiveThird, ThirdIchi)
// ————— Tenkan
plot(isActiveThirdTenkan ? thirdTenkan : na, color=colorLightPink, title="Third Tenkan", linewidth=1)
// ————— Kijun
plot(isActiveThirdKijun ? thirdKijun : na, color=colorDarkPink, title="Third Kijun", linewidth=2)
// ————— Chikou
plot(isActiveThirdChikou ? thirdChikou : na, offset = -thirdDisplacement, color=colorDarkPink, title="Third Chikou")
// ————— SSA + SSB
ssaThird=plot(isActiveThirdKumo ? thirdSSA : na, offset = thirdDisplacement, color=colorLightPink, title="Third SSA", linewidth=1)
ssbThird=plot(isActiveThirdKumo ? thirdSSB : na, offset = thirdDisplacement, color=colorLightPink, title="Third SSB", linewidth=1)
fill(ssaThird, ssbThird, color= isActiveThirdMonoKumo ? colorDarkPink : (thirdSSA > thirdSSB ? colorVeryLightPink : colorDarkPink), transp=transp, title="Third Kumo")
// ——————————————————————————————————————————————————————————————————————————————————————
// ————————————————————————————————— FOURTH ICHIMOKU ———————————————————————————————————
// ——————————————————————————————————————————————————————————————————————————————————————
[fourthDisplacement, fourthTenkan, fourthKijun, fourthChikou, fourthSSA, fourthSSB, fourthMiddleKumo] = f_ichimokuData(isActiveFourth, FourthIchi)
// ————— Tenkan
plot(isActiveFourthTenkan ? fourthTenkan : na, color=colorLightOrange, title="Fourth Tenkan", linewidth=1)
// ————— Kijun
plot(isActiveFourthKijun ? fourthKijun : na, color=colorDarkOrange, title="Fourth Kijun", linewidth=2)
// ————— Chikou
plot(isActiveFourthChikou ? fourthChikou : na, offset = -fourthDisplacement, color=colorDarkOrange, title="Fourth Chikou")
// ————— SSA + SSB
ssaFourth=plot(isActiveFourthKumo ? fourthSSA : na, offset = fourthDisplacement, color=colorLightOrange, title="Fourth SSA", linewidth=1)
ssbFourth=plot(isActiveFourthKumo ? fourthSSB : na, offset = fourthDisplacement, color=colorLightOrange, title="Fourth SSB", linewidth=1)
fill(ssaFourth, ssbFourth, color= isActiveFourthMonoKumo ? colorDarkOrange : (fourthSSA > fourthSSB ? colorVeryLightOrange : colorDarkOrange), transp=transp, title="Fourth Kumo")
// ——————————————————————————————————————————————————————————————————————————————————————
// ————————————————————————————————— FIFTH ICHIMOKU ———————————————————————————————————
// ——————————————————————————————————————————————————————————————————————————————————————
[fifthDisplacement, fifthTenkan, fifthKijun, fifthChikou, fifthSSA, fifthSSB, fifthMiddleKumo] = f_ichimokuData(isActiveFifth, FifthIchi)
// ————— Tenkan
plot(isActiveFifthTenkan ? fifthTenkan : na, color=colorLightViolet, title="Fifth Tenkan", linewidth=1)
// ————— Kijun
plot(isActiveFifthKijun ? fifthKijun : na, color=colorDarkViolet, title="Fifth Kijun", linewidth=2)
// ————— Chikou
plot(isActiveFifthChikou ? fifthChikou : na, offset = -fifthDisplacement, color=colorDarkViolet, title="Fifth Chikou")
// ————— SSA + SSB
ssaFifth=plot(isActiveFifthKumo ? fifthSSA : na, offset = fifthDisplacement, color=colorLightViolet, title="Fifth SSA", linewidth=1)
ssbFifth=plot(isActiveFifthKumo ? fifthSSB : na, offset = fifthDisplacement, color=colorLightViolet, title="Fifth SSB", linewidth=1)
fill(ssaFifth, ssbFifth, color= isActiveFifthMonoKumo ? colorDarkViolet : (fifthSSA > fifthSSB ? colorVeryLightViolet : colorDarkViolet), transp=transp, title="Fifth Kumo")
// ——————————————————————————————————————————————————————————————————————————————————————
// ————————————————————————————————— SIXTH ICHIMOKU ———————————————————————————————————
// ——————————————————————————————————————————————————————————————————————————————————————
[sixthDisplacement, sixthTenkan, sixthKijun, sixthChikou, sixthSSA, sixthSSB, sixthMiddleKumo] = f_ichimokuData(isActiveSixth, SixthIchi)
// ————— Tenkan
plot(isActiveSixthTenkan ? sixthTenkan : na, color=colorLightViolet, title="Sixth Tenkan", linewidth=1)
// ————— Kijun
plot(isActiveSixthKijun ? sixthKijun : na, color=colorDarkViolet, title="Sixth Kijun", linewidth=2)
// ————— Chikou
plot(isActiveSixthChikou ? sixthChikou : na, offset = -sixthDisplacement, color=colorDarkViolet, title="Sixth Chikou")
// ————— SSA + SSB
ssaSixth=plot(isActiveSixthKumo ? sixthSSA : na, offset = sixthDisplacement, color=colorLightViolet, title=" Sixth SSA", linewidth=1)
ssbSixth=plot(isActiveSixthKumo ? sixthSSB : na, offset = sixthDisplacement, color=colorLightViolet, title=" Sixth SSB", linewidth=1)
fill(ssaSixth, ssbSixth, color= isActiveSixthMonoKumo ? colorDarkViolet : (sixthSSA > sixthSSB ? colorVeryLightViolet : colorDarkViolet), transp=transp, title="Sixth Kumo")
// ——————————————————————————————————————————————————————————————————————————————————————
// ————————————————————————————————— SEVENTH ICHIMOKU ———————————————————————————————————
// ——————————————————————————————————————————————————————————————————————————————————————
[seventhDisplacement, seventhTenkan, seventhKijun, seventhChikou, seventhSSA, seventhSSB, seventhMiddleKumo] = f_ichimokuData(isActiveSeventh, SeventhIchi)
// ————— Tenkan
plot(isActiveSeventhTenkan ? seventhTenkan : na, color=colorLightViolet, title="Seventh Tenkan", linewidth=1)
// ————— Kijun
plot(isActiveSeventhKijun ? seventhKijun : na, color=colorDarkViolet, title="Seventh Kijun", linewidth=2)
// ————— Chikou
plot(isActiveSeventhChikou ? seventhChikou : na, offset = -seventhDisplacement, color=colorDarkViolet, title="Seventh Chikou")
// ————— SSA + SSB
ssaSeventh=plot(isActiveSeventhKumo ? seventhSSA : na, offset = seventhDisplacement, color=colorLightViolet, title=" Seventh SSA", linewidth=1)
ssbSeventh=plot(isActiveSeventhKumo ? seventhSSB : na, offset = seventhDisplacement, color=colorLightViolet, title=" Seventh SSB", linewidth=1)
fill(ssaSeventh, ssbSeventh, color= isActiveSeventhMonoKumo ? colorDarkViolet : (seventhSSA > seventhSSB ? colorVeryLightViolet : colorDarkViolet), transp=transp, title="Seventh Kumo")
// ——————————————————————————————————————————————————————————————————————————————————————
// ————————————————————————————————— EIGHTH ICHIMOKU ———————————————————————————————————
// ——————————————————————————————————————————————————————————————————————————————————————
[eighthDisplacement, eighthTenkan, eighthKijun, eighthChikou, eighthSSA, eighthSSB, eighthMiddleKumo] = f_ichimokuData(isActiveEighth, EighthIchi)
// ————— Tenkan
plot(isActiveEighthTenkan ? eighthTenkan : na, color=colorLightViolet, title="Eighth Tenkan", linewidth=1)
// ————— Kijun
plot(isActiveEighthKijun ? eighthKijun : na, color=colorDarkViolet, title="Eighth Kijun", linewidth=2)
// ————— Chikou
plot(isActiveEighthChikou ? eighthChikou : na, offset = -eighthDisplacement, color=colorDarkViolet, title="Eighth Chikou")
// ————— SSA + SSB
ssaEighth=plot(isActiveEighthKumo ? eighthSSA : na, offset = eighthDisplacement, color=colorLightViolet, title=" Eighth SSA", linewidth=1)
ssbEighth=plot(isActiveEighthKumo ? eighthSSB : na, offset = eighthDisplacement, color=colorLightViolet, title=" Eighth SSB", linewidth=1)
fill(ssaEighth, ssbEighth, color= isActiveEighthMonoKumo ? colorDarkViolet : (eighthSSA > eighthSSB ? colorVeryLightViolet : colorDarkViolet), transp=transp, title="Eighth Kumo")
// ——————————————————————————————————————————————————————————————————————————————————————
// ——————————————————————————————————————— LABEL ————————————————————————————————————————
// ——————————————————————————————————————————————————————————————————————————————————————
var label firstTenkanLabel = na
var label firstKijunLabel = na
var label firstChikouLabel = na
var label firstKumoLabel = na
var label secondTenkanLabel = na
var label secondKijunLabel = na
var label secondChikouLabel = na
var label secondKumoLabel = na
var label thirdTenkanLabel = na
var label thirdKijunLabel = na
var label thirdChikouLabel = na
var label thirdKumoLabel = na
var label fourthTenkanLabel = na
var label fourthKijunLabel = na
var label fourthChikouLabel = na
var label fourthKumoLabel = na
var label fifthTenkanLabel = na
var label fifthKijunLabel = na
var label fifthChikouLabel = na
var label fifthKumoLabel = na
var label sixthTenkanLabel = na
var label sixthKijunLabel = na
var label sixthChikouLabel = na
var label sixthKumoLabel = na
var label seventhTenkanLabel = na
var label seventhKijunLabel = na
var label seventhChikouLabel = na
var label seventhKumoLabel = na
var label eighthTenkanLabel = na
var label eighthKijunLabel = na
var label eighthChikouLabel = na
var label eighthKumoLabel = na
label.delete(firstTenkanLabel)
label.delete(firstKijunLabel)
label.delete(firstChikouLabel)
label.delete(firstKumoLabel)
label.delete(secondTenkanLabel)
label.delete(secondKijunLabel)
label.delete(secondChikouLabel)
label.delete(secondKumoLabel)
label.delete(thirdTenkanLabel)
label.delete(thirdKijunLabel)
label.delete(thirdChikouLabel)
label.delete(thirdKumoLabel)
label.delete(fourthTenkanLabel)
label.delete(fourthKijunLabel)
label.delete(fourthChikouLabel)
label.delete(fourthKumoLabel)
label.delete(fifthTenkanLabel)
label.delete(fifthKijunLabel)
label.delete(fifthChikouLabel)
label.delete(fifthKumoLabel)
label.delete(sixthTenkanLabel)
label.delete(sixthKijunLabel)
label.delete(sixthChikouLabel)
label.delete(sixthKumoLabel)
label.delete(seventhTenkanLabel)
label.delete(seventhKijunLabel)
label.delete(seventhChikouLabel)
label.delete(seventhKumoLabel)
label.delete(eighthTenkanLabel)
label.delete(eighthKijunLabel)
label.delete(eighthChikouLabel)
label.delete(eighthKumoLabel)
if isActiveFirst and isActiveFirstLabel
offsetLabelFirst=time+(timeOffset*labelFirstOffset)
offsetFirst=labelFirstOffset < 0 ? labelFirstOffset : 0
offsetDisplacementFirst=timeOffset*(firstDisplacement-labelFirstOffset)
if isActiveFirstTenkan
firstTenkanLabel:=label.new(x=offsetLabelFirst, y=firstTenkan[offsetFirst], xloc=xloc.bar_time, style=label.style_none)
label.set_text(firstTenkanLabel, f_getTenkanText(FirstIchi, isActiveFirstAbbreviation))
label.set_textcolor(firstTenkanLabel, labelFirstColor == 'Original' ? colorDarkBlue : f_stringInColor(labelFirstColor))
if isActiveFirstKijun
firstKijunLabel:=label.new(x=offsetLabelFirst, y=firstKijun[offsetFirst], xloc=xloc.bar_time, style=label.style_none)
label.set_text(firstKijunLabel, f_getKijunText(FirstIchi, isActiveFirstAbbreviation))
label.set_textcolor(firstKijunLabel, labelFirstColor == 'Original' ? colorDarkBlue : f_stringInColor(labelFirstColor))
if isActiveFirstChikou
firstChikouLabel:=label.new(x=time-offsetDisplacementFirst,y=firstChikou[1], xloc=xloc.bar_time, style=label.style_none)
label.set_text(firstChikouLabel, f_getChikouText(FirstIchi, isActiveFirstAbbreviation))
label.set_textcolor(firstChikouLabel, labelFirstColor == 'Original' ? colorDarkBlue : f_stringInColor(labelFirstColor))
if isActiveFirstKumo
firstKumoLabel:=label.new(x=time+offsetDisplacementFirst,y=fisrtMiddleKumo, xloc=xloc.bar_time, style=label.style_none)
label.set_text(firstKumoLabel, "Kumo "+f_resolutionInString(FirstIchi))
label.set_textcolor(firstKumoLabel, labelFirstColor == 'Original' ? colorDarkBlue : f_stringInColor(labelFirstColor))
if isActiveSecond and isActiveSecondLabel
offsetLabelSecond=time+(timeOffset*labelSecondOffset)
offsetSecond=labelSecondOffset < 0 ? labelSecondOffset : 0
offsetDisplacementSecond=timeOffset*(secondDisplacement-labelSecondOffset)
if isActiveSecondTenkan
secondTenkanLabel:=label.new(x=offsetLabelSecond, y=secondTenkan[offsetSecond], xloc=xloc.bar_time, style=label.style_none)
label.set_text(secondTenkanLabel, f_getTenkanText(SecondIchi, isActiveSecondAbbreviation))
label.set_textcolor(secondTenkanLabel, labelSecondColor == 'Original' ? colorDarkGreen : f_stringInColor(labelSecondColor))
if isActiveSecondKijun
secondKijunLabel:=label.new(x=offsetLabelSecond, y=secondKijun[offsetSecond], xloc=xloc.bar_time, style=label.style_none)
label.set_text(secondKijunLabel, f_getKijunText(SecondIchi, isActiveSecondAbbreviation))
label.set_textcolor(secondKijunLabel, labelSecondColor == 'Original' ? colorDarkGreen : f_stringInColor(labelSecondColor))
if isActiveSecondChikou
secondChikouLabel:=label.new(x=time-offsetDisplacementSecond,y=secondChikou[1], xloc=xloc.bar_time, style=label.style_none)
label.set_text(secondChikouLabel, f_getChikouText(SecondIchi, isActiveSecondAbbreviation))
label.set_textcolor(secondChikouLabel, labelSecondColor == 'Original' ? colorDarkGreen : f_stringInColor(labelSecondColor))
if isActiveSecondKumo
secondKumoLabel:=label.new(x=time+offsetDisplacementSecond,y=secondMiddleKumo, xloc=xloc.bar_time, style=label.style_none)
label.set_text(secondKumoLabel, "Kumo "+f_resolutionInString(SecondIchi))
label.set_textcolor(secondKumoLabel, labelSecondColor == 'Original' ? colorDarkGreen : f_stringInColor(labelSecondColor))
if isActiveThird and isActiveThirdLabel
offsetLabelThird=time+(timeOffset*labelThirdOffset)
offsetThird=labelThirdOffset < 0 ? labelThirdOffset : 0
offsetDisplacementThird=timeOffset*(thirdDisplacement-labelThirdOffset)
if isActiveThirdTenkan
thirdTenkanLabel:=label.new(x=offsetLabelThird, y=thirdTenkan[offsetThird], xloc=xloc.bar_time, style=label.style_none)
label.set_text(thirdTenkanLabel, f_getTenkanText(ThirdIchi, isActiveThirdAbbreviation))
label.set_textcolor(thirdTenkanLabel, labelThirdColor == 'Original' ? colorDarkPink : f_stringInColor(labelThirdColor))
if isActiveThirdKijun
thirdKijunLabel:=label.new(x=offsetLabelThird, y=thirdKijun[offsetThird], xloc=xloc.bar_time, style=label.style_none)
label.set_text(thirdKijunLabel, f_getKijunText(ThirdIchi, isActiveThirdAbbreviation))
label.set_textcolor(thirdKijunLabel, labelThirdColor == 'Original' ? colorDarkPink : f_stringInColor(labelThirdColor))
if isActiveThirdChikou
thirdChikouLabel:=label.new(x=time-offsetDisplacementThird,y=thirdChikou[1], xloc=xloc.bar_time, style=label.style_none)
label.set_text(thirdChikouLabel, f_getChikouText(ThirdIchi, isActiveThirdAbbreviation))
label.set_textcolor(thirdChikouLabel, labelThirdColor == 'Original' ? colorDarkPink : f_stringInColor(labelThirdColor))
if isActiveThirdKumo
thirdKumoLabel:=label.new(x=time+offsetDisplacementThird,y=thirdMiddleKumo, xloc=xloc.bar_time, style=label.style_none)
label.set_text(thirdKumoLabel, "Kumo "+f_resolutionInString(ThirdIchi))
label.set_textcolor(thirdKumoLabel, labelThirdColor == 'Original' ? colorDarkPink : f_stringInColor(labelThirdColor))
if isActiveFourth and isActiveFourthLabel
offsetLabelFourth=time+(timeOffset*labelFourthOffset)
offsetFourth=labelFourthOffset < 0 ? labelFourthOffset : 0
offsetDisplacementFourth=timeOffset*(fourthDisplacement-labelFourthOffset)
if isActiveFourthTenkan
fourthTenkanLabel:=label.new(x=offsetLabelFourth, y=fourthTenkan[offsetFourth], xloc=xloc.bar_time, style=label.style_none)
label.set_text(fourthTenkanLabel, f_getTenkanText(FourthIchi, isActiveFourthAbbreviation))
label.set_textcolor(fourthTenkanLabel, labelFourthColor == 'Original' ? colorDarkOrange : f_stringInColor(labelFourthColor))
if isActiveFourthKijun
fourthKijunLabel:=label.new(x=offsetLabelFourth, y=fourthKijun[offsetFourth], xloc=xloc.bar_time, style=label.style_none)
label.set_text(fourthKijunLabel, f_getKijunText(FourthIchi, isActiveFourthAbbreviation))
label.set_textcolor(fourthKijunLabel, labelFourthColor == 'Original' ? colorDarkOrange : f_stringInColor(labelFourthColor))
if isActiveFourthChikou
fourthChikouLabel:=label.new(x=time-offsetDisplacementFourth,y=fourthChikou[1], xloc=xloc.bar_time, style=label.style_none)
label.set_text(fourthChikouLabel, f_getChikouText(FourthIchi, isActiveFourthAbbreviation))
label.set_textcolor(fourthChikouLabel, labelFourthColor == 'Original' ? colorDarkOrange : f_stringInColor(labelFourthColor))
if isActiveFourthKumo
fourthKumoLabel:=label.new(x=time+offsetDisplacementFourth,y=fourthMiddleKumo, xloc=xloc.bar_time, style=label.style_none)
label.set_text(fourthKumoLabel, "Kumo "+f_resolutionInString(FourthIchi))
label.set_textcolor(fourthKumoLabel, labelFourthColor == 'Original' ? colorDarkOrange : f_stringInColor(labelFourthColor))
if isActiveFifth and isActiveFifthLabel
offsetLabelFifth=time+(timeOffset*labelFifthOffset)
offsetFifth=labelFifthOffset < 0 ? labelFifthOffset : 0
offsetDisplacementFifth=timeOffset*(fifthDisplacement-labelFifthOffset)
if isActiveFifthTenkan
fifthTenkanLabel:=label.new(x=offsetLabelFifth, y=fifthTenkan[offsetFifth], xloc=xloc.bar_time, style=label.style_none)
label.set_text(fifthTenkanLabel, f_getTenkanText(FifthIchi, isActiveFifthAbbreviation))
label.set_textcolor(fifthTenkanLabel, labelFifthColor == 'Original' ? colorDarkViolet : f_stringInColor(labelFifthColor))
if isActiveFifthKijun
fifthKijunLabel:=label.new(x=offsetLabelFifth, y=fifthKijun[offsetFifth], xloc=xloc.bar_time, style=label.style_none)
label.set_text(fifthKijunLabel, f_getKijunText(FifthIchi, isActiveFifthAbbreviation))
label.set_textcolor(fifthKijunLabel, labelFifthColor == 'Original' ? colorDarkViolet : f_stringInColor(labelFifthColor))
if isActiveFifthChikou
fifthChikouLabel:=label.new(x=time-offsetDisplacementFifth,y=fifthChikou[1], xloc=xloc.bar_time, style=label.style_none)
label.set_text(fifthChikouLabel, f_getChikouText(FifthIchi, isActiveFifthAbbreviation))
label.set_textcolor(fifthChikouLabel, labelFifthColor == 'Original' ? colorDarkViolet : f_stringInColor(labelFifthColor))
if isActiveFifthKumo
fifthKumoLabel:=label.new(x=time+offsetDisplacementFifth,y=fifthMiddleKumo, xloc=xloc.bar_time, style=label.style_none)
label.set_text(fifthKumoLabel, "Kumo "+f_resolutionInString(FifthIchi))
label.set_textcolor(fifthKumoLabel, labelFifthColor == 'Original' ? colorDarkViolet : f_stringInColor(labelFifthColor))
if isActiveSixth and isActiveSixthLabel
offsetLabelSixth=time+(timeOffset*labelSixthOffset)
offsetSixth=labelSixthOffset < 0 ? labelSixthOffset : 0
offsetDisplacementSixth=timeOffset*(sixthDisplacement-labelSixthOffset)
if isActiveSixthTenkan
sixthTenkanLabel:=label.new(x=offsetLabelSixth, y=sixthTenkan[offsetSixth], xloc=xloc.bar_time, style=label.style_none)
label.set_text(sixthTenkanLabel, f_getTenkanText(SixthIchi, isActiveSixthAbbreviation))
label.set_textcolor(sixthTenkanLabel, labelSixthColor == 'Original' ? colorDarkViolet : f_stringInColor(labelSixthColor))
if isActiveSixthKijun
sixthKijunLabel:=label.new(x=offsetLabelSixth, y=sixthKijun[offsetSixth], xloc=xloc.bar_time, style=label.style_none)
label.set_text(sixthKijunLabel, f_getKijunText(SixthIchi, isActiveSixthAbbreviation))
label.set_textcolor(sixthKijunLabel, labelSixthColor == 'Original' ? colorDarkViolet : f_stringInColor(labelSixthColor))
if isActiveSixthChikou
sixthChikouLabel:=label.new(x=time-offsetDisplacementSixth,y=sixthChikou[1], xloc=xloc.bar_time, style=label.style_none)
label.set_text(sixthChikouLabel, f_getChikouText(SixthIchi, isActiveSixthAbbreviation))
label.set_textcolor(sixthChikouLabel, labelSixthColor == 'Original' ? colorDarkViolet : f_stringInColor(labelSixthColor))
if isActiveSixthKumo
sixthKumoLabel:=label.new(x=time+offsetDisplacementSixth,y=sixthMiddleKumo, xloc=xloc.bar_time, style=label.style_none)
label.set_text(sixthKumoLabel, "Kumo "+f_resolutionInString(SixthIchi))
label.set_textcolor(sixthKumoLabel, labelSixthColor == 'Original' ? colorDarkViolet : f_stringInColor(labelSixthColor))
if isActiveSeventh and isActiveSeventhLabel
offsetLabelSeventh=time+(timeOffset*labelSeventhOffset)
offsetSeventh=labelSeventhOffset < 0 ? labelSeventhOffset : 0
offsetDisplacementSeventh=timeOffset*(seventhDisplacement-labelSeventhOffset)
if isActiveSeventhTenkan
seventhTenkanLabel:=label.new(x=offsetLabelSeventh, y=seventhTenkan[offsetSeventh], xloc=xloc.bar_time, style=label.style_none)
label.set_text(seventhTenkanLabel, f_getTenkanText(SeventhIchi, isActiveSeventhAbbreviation))
label.set_textcolor(seventhTenkanLabel, labelSeventhColor == 'Original' ? colorDarkViolet : f_stringInColor(labelSeventhColor))
if isActiveSeventhKijun
seventhKijunLabel:=label.new(x=offsetLabelSeventh, y=seventhKijun[offsetSeventh], xloc=xloc.bar_time, style=label.style_none)
label.set_text(seventhKijunLabel, f_getKijunText(SeventhIchi, isActiveSeventhAbbreviation))
label.set_textcolor(seventhKijunLabel, labelSeventhColor == 'Original' ? colorDarkViolet : f_stringInColor(labelSeventhColor))
if isActiveSeventhChikou
seventhChikouLabel:=label.new(x=time-offsetDisplacementSeventh,y=seventhChikou[1], xloc=xloc.bar_time, style=label.style_none)
label.set_text(seventhChikouLabel, f_getChikouText(SeventhIchi, isActiveSeventhAbbreviation))
label.set_textcolor(seventhChikouLabel, labelSeventhColor == 'Original' ? colorDarkViolet : f_stringInColor(labelSeventhColor))
if isActiveSeventhKumo
seventhKumoLabel:=label.new(x=time+offsetDisplacementSeventh,y=seventhMiddleKumo, xloc=xloc.bar_time, style=label.style_none)
label.set_text(seventhKumoLabel, "Kumo "+f_resolutionInString(SeventhIchi))
label.set_textcolor(seventhKumoLabel, labelSeventhColor == 'Original' ? colorDarkViolet : f_stringInColor(labelSeventhColor))
if isActiveEighth and isActiveEighthLabel
offsetLabelEighth=time+(timeOffset*labelEighthOffset)
offsetEighth=labelEighthOffset < 0 ? labelEighthOffset : 0
offsetDisplacementEighth=timeOffset*(eighthDisplacement-labelEighthOffset)
if isActiveEighthTenkan
eighthTenkanLabel:=label.new(x=offsetLabelEighth, y=eighthTenkan[offsetEighth], xloc=xloc.bar_time, style=label.style_none)
label.set_text(eighthTenkanLabel, f_getTenkanText(EighthIchi, isActiveEighthAbbreviation))
label.set_textcolor(eighthTenkanLabel, labelEighthColor == 'Original' ? colorDarkViolet : f_stringInColor(labelEighthColor))
if isActiveEighthKijun
eighthKijunLabel:=label.new(x=offsetLabelEighth, y=eighthKijun[offsetEighth], xloc=xloc.bar_time, style=label.style_none)
label.set_text(eighthKijunLabel, f_getKijunText(EighthIchi, isActiveEighthAbbreviation))
label.set_textcolor(eighthKijunLabel, labelEighthColor == 'Original' ? colorDarkViolet : f_stringInColor(labelEighthColor))
if isActiveEighthChikou
eighthChikouLabel:=label.new(x=time-offsetDisplacementEighth,y=eighthChikou[1], xloc=xloc.bar_time, style=label.style_none)
label.set_text(eighthChikouLabel, f_getChikouText(EighthIchi, isActiveEighthAbbreviation))
label.set_textcolor(eighthChikouLabel, labelEighthColor == 'Original' ? colorDarkViolet : f_stringInColor(labelEighthColor))
if isActiveEighthKumo
eighthKumoLabel:=label.new(x=time+offsetDisplacementEighth,y=eighthMiddleKumo, xloc=xloc.bar_time, style=label.style_none)
label.set_text(eighthKumoLabel, "Kumo "+f_resolutionInString(EighthIchi))
label.set_textcolor(eighthKumoLabel, labelEighthColor == 'Original' ? colorDarkViolet : f_stringInColor(labelEighthColor))
// ——————————————————————————————————————————————————————————————————————————————————————
// ——————————————————————————————————————— CLOUD VARIABLES ——————————————————————————————
// ——————————————————————————————————————————————————————————————————————————————————————
//1st cloud now
displacedfirstSSA = firstSSA[displacement]
displacedfirstSSB = firstSSB[displacement]
//2nd cloud now
displacedsecondSSA = secondSSA[displacement]
displacedsecondSSB = secondSSB[displacement]
//3rd cloud now
displacedthirdSSA = thirdSSA[displacement]
displacedthirdSSB = thirdSSB[displacement]
//4th cloud now
displacedfourthSSA = fourthSSA[displacement]
displacedfourthSSB = fourthSSB[displacement]
//5th cloud now
displacedfifthSSA = fifthSSA[displacement]
displacedfifthSSB = fifthSSB[displacement]
//6th cloud now
displacedsixthSSA = sixthSSA[displacement]
displacedsixthSSB = sixthSSB[displacement]
//7th cloud now
displacedseventhSSA = seventhSSA[displacement]
displacedseventhSSB = seventhSSB[displacement]
//8th cloud now
displacedeighthSSA = eighthSSA[displacement]
displacedeighthSSB = eighthSSB[displacement]
//1st cloud 26 periods ago
twodisplacedfirstSSA = firstSSA[2*displacement]
twodisplacedfirstSSB = firstSSB[2*displacement]
//2nd cloud 26 periods ago
twodisplacedsecondSSA = secondSSA[2*displacement]
twodisplacedsecondSSB = secondSSB[2*displacement]
//3rd cloud 26 periods ago
twodisplacedthirdSSA = thirdSSA[2*displacement]
twodisplacedthirdSSB = thirdSSB[2*displacement]
//4th cloud 26 periods ago
twodisplacedfourthSSA = fourthSSA[2*displacement]
twodisplacedfourthSSB = fourthSSB[2*displacement]
//5th cloud 26 periods ago
twodisplacedfifthSSA = fifthSSA[2*displacement]
twodisplacedfifthSSB = fifthSSB[2*displacement]
//6th cloud 26 periods ago
twodisplacedsixthSSA = sixthSSA[2*displacement]
twodisplacedsixthSSB = sixthSSB[2*displacement]
//7th cloud 26 periods ago
twodisplacedseventhSSA = seventhSSA[2*displacement]
twodisplacedseventhSSB = seventhSSB[2*displacement]
//8th cloud 26 periods ago
twodisplacedeighthSSA = eighthSSA[2*displacement]
twodisplacedeighthSSB = eighthSSB[2*displacement]
// ——————————————————————————————————————————————————————————————————————————————————————
// ——————————————————————————————————————— FILTERING CONDITIONS —————————————————————————
// ——————————————————————————————————————————————————————————————————————————————————————
//filtering conditions - price in relation to cloud
PriceInOrAboveFirstCloud = close>=min(displacedfirstSSA, displacedfirstSSB)
PriceInOrBelowFirstCloud = close<=max(displacedfirstSSA, displacedfirstSSB)
PriceInOrAboveSecondCloud = close>=min(displacedsecondSSA, displacedsecondSSB)
PriceInOrBelowSecondCloud = close<=max(displacedsecondSSA, displacedsecondSSB)
PriceInOrAboveThirdCloud = close>=min(displacedthirdSSA, displacedthirdSSB)
PriceInOrBelowThirdCloud = close<=max(displacedthirdSSA, displacedthirdSSB)
PriceInOrAboveFourthCloud = close>=min(displacedfourthSSA, displacedfourthSSB)
PriceInOrBelowFourthCloud = close<=max(displacedfourthSSA, displacedfourthSSB)
PriceInOrAboveFifthCloud = close>=min(displacedfifthSSA, displacedfifthSSB)
PriceInOrBelowFifthCloud = close<=max(displacedfifthSSA, displacedfifthSSB)
PriceInOrAboveSixthCloud = close>=min(displacedsixthSSA, displacedsixthSSB)
PriceInOrBelowSixthCloud = close<=max(displacedsixthSSA, displacedsixthSSB)
PriceInOrAboveSeventhCloud = close>=min(displacedseventhSSA, displacedseventhSSB)
PriceInOrBelowSeventhCloud = close<=max(displacedseventhSSA, displacedseventhSSB)
PriceInOrAboveEighthCloud = close>=min(displacedeighthSSA, displacedeighthSSB)
PriceInOrBelowEighthCloud = close<=max(displacedeighthSSA, displacedeighthSSB)
PriceInFirstCloud = close<max(displacedfirstSSA, displacedfirstSSB) and close>min(displacedfirstSSA, displacedfirstSSB)
PriceInSecondCloud = close<max(displacedsecondSSA, displacedsecondSSB) and close>min(displacedsecondSSA, displacedsecondSSB)
PriceInThirdCloud = close<max(displacedthirdSSA, displacedthirdSSB) and close>min(displacedthirdSSA, displacedthirdSSB)
PriceInFourthCloud = close<max(displacedfourthSSA, displacedfourthSSB) and close>min(displacedfourthSSA, displacedfourthSSB)
PriceInFifthCloud = close<max(displacedfifthSSA, displacedfifthSSB) and close>min(displacedfifthSSA, displacedfifthSSB)
PriceInSixthCloud = close<max(displacedsixthSSA, displacedsixthSSB) and close>min(displacedsixthSSA, displacedsixthSSB)
PriceInSeventhCloud = close<max(displacedseventhSSA, displacedseventhSSB) and close>min(displacedseventhSSA, displacedseventhSSB)
PriceInEighthCloud = close<max(displacedeighthSSA, displacedeighthSSB) and close>min(displacedeighthSSA, displacedeighthSSB)
PriceAboveFirstCloud = close>max(displacedfirstSSA, displacedfirstSSB)
PriceBelowFirstCloud = close<min(displacedfirstSSA, displacedfirstSSB)
PriceAboveSecondCloud = close>max(displacedsecondSSA, displacedsecondSSB)
PriceBelowSecondCloud = close<min(displacedsecondSSA, displacedsecondSSB)
PriceAboveThirdCloud = close>max(displacedthirdSSA, displacedthirdSSB)
PriceBelowThirdCloud = close<min(displacedthirdSSA, displacedthirdSSB)
PriceAboveFourthCloud = close>max(displacedfourthSSA, displacedfourthSSB)
PriceBelowFourthCloud = close<min(displacedfourthSSA, displacedfourthSSB)
PriceAboveFifthCloud = close>max(displacedfifthSSA, displacedfifthSSB)
PriceBelowFifthCloud = close<min(displacedfifthSSA, displacedfifthSSB)
PriceAboveSixthCloud = close>max(displacedsixthSSA, displacedsixthSSB)
PriceBelowSixthCloud = close<min(displacedsixthSSA, displacedsixthSSB)
PriceAboveSeventhCloud = close>max(displacedseventhSSA, displacedseventhSSB)
PriceBelowSeventhCloud = close<min(displacedseventhSSA, displacedseventhSSB)
PriceAboveEighthCloud = close>max(displacedeighthSSA, displacedeighthSSB)
PriceBelowEighthCloud = close<min(displacedeighthSSA, displacedeighthSSB)
//filtering conditions - price in relation to Tenkan
PriceAboveFirstTenkan = close>=firstTenkan
PriceBelowFirstTenkan = close<=firstTenkan
PriceAboveSecondTenkan = close>=secondTenkan
PriceBelowSecondTenkan = close<=secondTenkan
PriceAboveThirdTenkan = close>=thirdTenkan
PriceBelowThirdTenkan = close<=thirdTenkan
PriceAboveFourthTenkan = close>=fourthTenkan
PriceBelowFourthTenkan = close<=fourthTenkan
PriceAboveFifthTenkan = close>=fifthTenkan
PriceBelowFifthTenkan = close<=fifthTenkan
PriceAboveSixthTenkan = close>=sixthTenkan
PriceBelowSixthTenkan = close<=sixthTenkan
PriceAboveSeventhTenkan = close>=seventhTenkan
PriceBelowSeventhTenkan = close<=seventhTenkan
PriceAboveEighthTenkan = close>=eighthTenkan
PriceBelowEighthTenkan = close<=eighthTenkan
//filtering conditions - price in relation to Kijun
PriceAboveFirstKijun = close>=firstKijun
PriceBelowFirstKijun = close<=firstKijun
PriceAboveSecondKijun = close>=secondKijun
PriceBelowSecondKijun = close<=secondKijun
PriceAboveThirdKijun = close>=thirdKijun
PriceBelowThirdKijun = close<=thirdKijun
PriceAboveFourthKijun = close>=fourthKijun
PriceBelowFourthKijun = close<=fourthKijun
PriceAboveFifthKijun = close>=fifthKijun
PriceBelowFifthKijun = close<=fifthKijun
PriceAboveSixthKijun = close>=sixthKijun
PriceBelowSixthKijun = close<=sixthKijun
PriceAboveSeventhKijun = close>=seventhKijun
PriceBelowSeventhKijun = close<=seventhKijun
PriceAboveEighthKijun = close>=eighthKijun
PriceBelowEighthKijun = close<=eighthKijun
//filtering conditions - future cloud
FirstFutureCloudBullish = firstSSA>firstSSB
FirstFutureCloudBearish = firstSSA<firstSSB
SecondFutureCloudBullish = secondSSA>secondSSB
SecondFutureCloudBearish = secondSSA<secondSSB
ThirdFutureCloudBullish = thirdSSA>thirdSSB
ThirdFutureCloudBearish = thirdSSA<thirdSSB
FourthFutureCloudBullish = fourthSSA>fourthSSB
FourthFutureCloudBearish = fourthSSA<fourthSSB
FifthFutureCloudBullish = fifthSSA>fifthSSB
FifthFutureCloudBearish = fifthSSA<fifthSSB
SixthFutureCloudBullish = sixthSSA>sixthSSB
SixthFutureCloudBearish = sixthSSA<sixthSSB
SeventhFutureCloudBullish = seventhSSA>seventhSSB
SeventhFutureCloudBearish = seventhSSA<seventhSSB
EighthFutureCloudBullish = eighthSSA>eighthSSB
EighthFutureCloudBearish = eighthSSA<eighthSSB
//filterting conditions - tenkan and kijun positions
FirstTenkanAboveKijun = firstTenkan>firstKijun
FirstTenkanBelowKijun = firstTenkan<firstKijun
SecondTenkanAboveKijun = secondTenkan>secondKijun
SecondTenkanBelowKijun = secondTenkan<secondKijun
ThirdTenkanAboveKijun = thirdTenkan>thirdKijun
ThirdTenkanBelowKijun = thirdTenkan<thirdKijun
FourthTenkanAboveKijun = fourthTenkan>fourthKijun
FourthTenkanBelowKijun = fourthTenkan<fourthKijun
FifthTenkanAboveKijun = fifthTenkan>fifthKijun
FifthTenkanBelowKijun = fifthTenkan<fifthKijun
SixthTenkanAboveKijun = sixthTenkan>sixthKijun
SixthTenkanBelowKijun = sixthTenkan<sixthKijun
SeventhTenkanAboveKijun = seventhTenkan>seventhKijun
SeventhTenkanBelowKijun = seventhTenkan<seventhKijun
EighthTenkanAboveKijun = eighthTenkan>eighthKijun
EighthTenkanBelowKijun = eighthTenkan<eighthKijun
//filtering conditions - chikou position in relation to cloud
FirstChikouInCloud = close>min(twodisplacedfirstSSA, twodisplacedfirstSSB) and close<max(twodisplacedfirstSSA, twodisplacedfirstSSB)
SecondChikouInCloud = close>min(twodisplacedsecondSSA, twodisplacedsecondSSB) and close<max(twodisplacedsecondSSA, twodisplacedsecondSSB)
ThirdChikouInCloud = close>min(twodisplacedthirdSSA, twodisplacedthirdSSB) and close<max(twodisplacedthirdSSA, twodisplacedthirdSSB)
FourthChikouInCloud = close>min(twodisplacedfourthSSA, twodisplacedfourthSSB) and close<max(twodisplacedfourthSSA, twodisplacedfourthSSB)
FifthChikouInCloud = close>min(twodisplacedfifthSSA, twodisplacedfifthSSB) and close<max(twodisplacedfifthSSA, twodisplacedfifthSSB)
SixthChikouInCloud = close>min(twodisplacedsixthSSA, twodisplacedsixthSSB) and close<max(twodisplacedsixthSSA, twodisplacedsixthSSB)
SeventhChikouInCloud = close>min(twodisplacedseventhSSA, twodisplacedseventhSSB) and close<max(twodisplacedseventhSSA, twodisplacedseventhSSB)
EighthChikouInCloud = close>min(twodisplacedeighthSSA, twodisplacedeighthSSB) and close<max(twodisplacedeighthSSA, twodisplacedeighthSSB)
FirstChikouAboveCloud = close>max(twodisplacedfirstSSA, twodisplacedfirstSSB)
FirstChikouBelowCloud = close<min(twodisplacedfirstSSA, twodisplacedfirstSSB)
SecondChikouAboveCloud = close>max(twodisplacedsecondSSA, twodisplacedsecondSSB)
SecondChikouBelowCloud = close<min(twodisplacedfirstSSA, twodisplacedfirstSSB)
ThirdChikouAboveCloud = close>max(twodisplacedthirdSSA, twodisplacedthirdSSB)
ThirdChikouBelowCloud = close<min(twodisplacedthirdSSA, twodisplacedthirdSSB)
FourthChikouAboveCloud = close>max(twodisplacedfourthSSA, twodisplacedfourthSSB)
FourthChikouBelowCloud = close<min(twodisplacedfourthSSA, twodisplacedfourthSSB)
FifthChikouAboveCloud = close>max(twodisplacedfifthSSA, twodisplacedfifthSSB)
FifthChikouBelowCloud = close<min(twodisplacedfifthSSA, twodisplacedfifthSSB)
SixthChikouAboveCloud = close>max(twodisplacedsixthSSA, twodisplacedsixthSSB)
SixthChikouBelowCloud = close<min(twodisplacedsixthSSA, twodisplacedsixthSSB)
SeventhChikouAboveCloud = close>max(twodisplacedseventhSSA, twodisplacedseventhSSB)
SeventhChikouBelowCloud = close<min(twodisplacedseventhSSA, twodisplacedseventhSSB)
EighthChikouAboveCloud = close>max(twodisplacedeighthSSA, twodisplacedeighthSSB)
EighthChikouBelowCloud = close<min(twodisplacedeighthSSA, twodisplacedeighthSSB)
// ——————————————————————————————————————————————————————————————————————————————————————
// ——————————————————————————————————————— ALERT CONDITIONS —————————————————————————————
// ——————————————————————————————————————————————————————————————————————————————————————
//alert conditions - TKCross
FirstTKCrossBullish = crossover(firstTenkan, firstKijun)
FirstTKCrossBearish = crossunder(firstTenkan, firstKijun)
SecondTKCrossBullish = crossover(secondTenkan, secondKijun)
SecondTKCrossBearish = crossunder(secondTenkan, secondKijun)
ThirdTKCrossBullish = crossover(thirdTenkan, thirdKijun)
ThirdTKCrossBearish = crossunder(thirdTenkan, thirdKijun)
FourthTKCrossBullish = crossover(fourthTenkan, fourthKijun)
FourthTKCrossBearish = crossunder(fourthTenkan, fourthKijun)
FifthTKCrossBullish = crossover(fifthTenkan, fifthKijun)
FifthTKCrossBearish = crossunder(fifthTenkan, fifthKijun)
SixthTKCrossBullish = crossover(sixthTenkan, sixthKijun)
SixthTKCrossBearish = crossunder(sixthTenkan, sixthKijun)
SeventhTKCrossBullish = crossover(seventhTenkan, seventhKijun)
SeventhTKCrossBearish = crossunder(seventhTenkan, seventhKijun)
EighthTKCrossBullish = crossover(eighthTenkan, eighthKijun)
EighthTKCrossBearish = crossunder(eighthTenkan, eighthKijun)
//alert conditions - ChikouCrossCloud
FirstChikouCrossBulish = crossover(firstChikou, max(twodisplacedfirstSSA, twodisplacedfirstSSB))
FirstChikouCrossBearish = crossunder(firstChikou, min(twodisplacedfirstSSA, twodisplacedfirstSSB))
SecondChikouCrossBulish = crossover(secondChikou, max(twodisplacedsecondSSA, twodisplacedsecondSSB))
SecondChikouCrossBearish = crossunder(secondChikou, min(twodisplacedsecondSSA, twodisplacedsecondSSB))
ThirdChikouCrossBulish = crossover(thirdChikou, max(twodisplacedthirdSSA, twodisplacedthirdSSB))
ThirdChikouCrossBearish = crossunder(thirdChikou, min(twodisplacedthirdSSA, twodisplacedthirdSSB))
FourthChikouCrossBulish = crossover(fourthChikou, max(twodisplacedfourthSSA, twodisplacedfourthSSB))
FourthChikouCrossBearish = crossunder(fourthChikou, min(twodisplacedfourthSSA, twodisplacedfourthSSB))
FifthChikouCrossBulish = crossover(fifthChikou, max(twodisplacedfifthSSA, twodisplacedfifthSSB))
FifthChikouCrossBearish = crossunder(fifthChikou, min(twodisplacedfifthSSA, twodisplacedfifthSSB))
SixthChikouCrossBulish = crossover(sixthChikou, max(twodisplacedsixthSSA, twodisplacedsixthSSB))
SixthChikouCrossBearish = crossunder(sixthChikou, min(twodisplacedsixthSSA, twodisplacedsixthSSB))
SeventhChikouCrossBulish = crossover(seventhChikou, max(twodisplacedseventhSSA, twodisplacedseventhSSB))
SeventhChikouCrossBearish = crossunder(seventhChikou, min(twodisplacedseventhSSA, twodisplacedseventhSSB))
EighthChikouCrossBulish = crossover(eighthChikou, max(twodisplacedeighthSSA, twodisplacedeighthSSB))
EighthChikouCrossBearish = crossunder(eighthChikou, min(twodisplacedeighthSSA, twodisplacedeighthSSB))
//alert conditions - ChikouCrossPrice
ChikouCrossPriceBullish = crossover(close, high[25]) and close[1]<high[26] and close[2]<high[27]
ChikouCrossPriceBearish = crossunder(close, low[25]) and close[1]>high[26] and close[2]>high[27]
// ——————————————————————————————————————————————————————————————————————————————————————
// ——————————————————————————————————————— ALERT EXAMPLES ———————————————————————————————
// ——————————————————————————————————————————————————————————————————————————————————————
if PriceInOrAboveSeventhCloud
alert('{"content": "Test - '+ syminfo.ticker +' \\n <https://www.tradingview.com/chart/?symbol='+ syminfo.ticker +'> \\n -----------------------------------------"}', alert.freq_once_per_bar)
//if SixthTKCrossBullish and PriceAboveSixthCloud and PriceInOrAboveSeventhCloud
//alert('{"content": "Test - '+ syminfo.ticker +' \\n <https://www.tradingview.com/chart/?symbol='+ syminfo.ticker +'> \\n -----------------------------------------"}', alert.freq_once_per_bar)