-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSF-Ichimoku-toggle-normal-doubleLookback-verified.txt
42 lines (39 loc) · 3.24 KB
/
SF-Ichimoku-toggle-normal-doubleLookback-verified.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
//@version=5
indicator(title="Ichimoku MQ", shorttitle="Ichimoku MQ", overlay=true)
normalIchi = input.bool(true, title="Standard Ichi (deselect for double lookback Ichi)")
// Standard Ichimoku
conversionPeriods = input.int(9, minval=1, title="Conversion Line Length (standard)", group="Standard Ichimoku")
basePeriods = input.int(26, minval=1, title="Base Line Length (standard)", group="Standard Ichimoku")
laggingSpan2Periods = input.int(52, minval=1, title="Leading Span B Length (standard)", group="Standard Ichimoku")
displacement = input.int(26, minval=1, title="Displacement (standard)", group="Standard Ichimoku")
donchian(len) => math.avg(ta.lowest(len), ta.highest(len))
conversionLine = donchian(conversionPeriods)
baseLine = donchian(basePeriods)
leadLine1 = math.avg(conversionLine, baseLine)
leadLine2 = donchian(laggingSpan2Periods)
plot(normalIchi ? conversionLine : na, color=#1E90FF, title="Conversion Line (normal)", linewidth=2)
plot(normalIchi ? baseLine : na, color=color.yellow, title="Base Line (normal)", linewidth=2)
plot(normalIchi ? close : na, offset = -displacement + 1, color=color.lime, title="Lagging Span (normal)")
p1 = plot(normalIchi ? leadLine1 : na, offset = displacement - 1, color=color.rgb(76, 175, 80, 95), title="Leading Span A (normal)") // transparency is the fourth rgb parameter
p2 = plot(normalIchi ? leadLine2 : na, offset = displacement - 1, color=color.rgb(255, 82, 82, 95), title="Leading Span B (normal)")
colRed = color.rgb(244, 67, 54, 50)
colGreen = color.rgb(67, 160, 71, 50)
fill(p1, p2, color = leadLine1 > leadLine2 ? (normalIchi?colGreen:na) : (normalIchi?colRed:na), title="Cloud Colors (standard)")
// Double look-back Ichimoku (used as default by Predictimoku)
conversionPeriodsDLB = input.int(20, minval=1, title="Conversion Line Length (double)", group="Double Lookback Ichimoku")
basePeriodsDLB = input.int(60, minval=1, title="Base Line Length (double)", group="Double Lookback Ichimoku")
laggingSpan2PeriodsDLB = input.int(120, minval=1, title="Leading Span B Length (double)", group="Double Lookback Ichimoku")
displacementDLB = input.int(30, minval=1, title="Displacement (double)", group="Double Lookback Ichimoku")
donchianDLB(len) => math.avg(ta.lowest(len), ta.highest(len))
conversionLineDLB = donchianDLB(conversionPeriodsDLB)
baseLineDLB = donchianDLB(basePeriodsDLB)
leadLine1DLB = math.avg(conversionLineDLB, baseLineDLB)
leadLine2DLB = donchianDLB(laggingSpan2PeriodsDLB)
plot(normalIchi ? na : conversionLineDLB, color=#1E90FF, title="Conversion Line (double)", linewidth=2)
plot(normalIchi ? na : baseLineDLB, color=color.yellow, title="Base Line (double)", linewidth=2)
plot(normalIchi ? na : close, offset = -displacementDLB + 1, color=color.lime, title="Lagging Span (double)")
p1DLB = plot(normalIchi ? na : leadLine1DLB, offset = displacementDLB - 1, color=color.rgb(76, 175, 80, 95), title="Leading Span A (double)") // transparency is the fourth rgb parameter
p2DLB = plot(normalIchi ? na : leadLine2DLB, offset = displacementDLB - 1, color=color.rgb(255, 82, 82, 95), title="Leading Span B (double)")
colRedDLB = color.rgb(244, 67, 54, 50)
colGreenDLB = color.rgb(67, 160, 71, 50)
fill(p1DLB, p2DLB, color = leadLine1DLB > leadLine2DLB ? (normalIchi?na:colGreenDLB) : (normalIchi?na:colRedDLB), title="Cloud Colors (double)")