Intriquality
New member
Hello!
I'm trying to make an Ichimoku Cloud (SPAN B) support/resistance line drawer, but I'm unsure how to extend the lines to the right.
The indicator looks for flat areas (flat over at least a 20-bar period) on the SPAN B portion of the Ichimoku Cloud and draws the line there.
My amazing, unparalleled display of scripting prowess (sarcasm) is displayed below.
This is what the indicator is trying to do:
This is what I have it looking like so far:
This is what I'm trying to turn it into:
I also have a secondary, less important issue of this indicator not working on any timeframe higher than the 1D. Not sure why.
Here's the script:
I'm trying to make an Ichimoku Cloud (SPAN B) support/resistance line drawer, but I'm unsure how to extend the lines to the right.
The indicator looks for flat areas (flat over at least a 20-bar period) on the SPAN B portion of the Ichimoku Cloud and draws the line there.
My amazing, unparalleled display of scripting prowess (sarcasm) is displayed below.
This is what the indicator is trying to do:
This is what I have it looking like so far:
This is what I'm trying to turn it into:
I also have a secondary, less important issue of this indicator not working on any timeframe higher than the 1D. Not sure why.
Here's the script:
declare upper;
def kijun_period = 26;
def dP = aggregationPeriod.DAY;
def wP = aggregationPeriod.WEEK;
def mP = aggregationPeriod.MONTH;
def dKijun = (Highest(high (period=dP), kijun_period) + Lowest(low (period=dP), kijun_period)) / 2;
def span_B = (Highest(high (period=dP)[kijun_period], 2 * kijun_period) + Lowest(low (period=dP)[kijun_period], 2 * kijun_period)) / 2;
def dailyCloudLineB = if span_B[-16] == span_B[-17] and
span_B[-17] == span_B[-18] and
span_B[-18] == span_B[-19] and
span_B[-19] == span_B[-20] and
span_B[-20] == span_B[-21] and
span_B[-21] == span_B[-22] and
span_B[-22] == span_B[-23] and
span_B[-23] == span_B[-24] and
span_B[-24] == span_B[-25] and
span_B[-25] == span_B[-26]
then span_B[-26] else double.NAN;
plot daily = dailyCloudLineB[16];
#----------------------------WEEKLY CLOUDLINES
def wKijun = (Highest(high (period=wP), kijun_period) + Lowest(low (period=wP), kijun_period)) / 2;
def wSpan_B = (Highest(high (period=wP)[kijun_period], 2 * kijun_period) + Lowest(low (period=wP)[kijun_period], 2 * kijun_period)) / 2;
def weeklyCloudLineB = if wSpan_B[-16] == wSpan_B[-17] and
wSpan_B[-17] == wSpan_B[-18] and
wSpan_B[-18] == wSpan_B[-19] and
wSpan_B[-19] == wSpan_B[-20] and
wSpan_B[-20] == wSpan_B[-21] and
wSpan_B[-21] == wSpan_B[-22] and
wSpan_B[-22] == wSpan_B[-23] and
wSpan_B[-23] == wSpan_B[-24] and
wSpan_B[-24] == wSpan_B[-25] and
wSpan_B[-25] == wSpan_B[-26]
then wSpan_B[-26] else double.NAN;
plot weekly = weeklyCloudLineB[16];
#----------------------------MONTHLY CLOUDLINES
def mKijun = (Highest(high (period=mP), kijun_period) + Lowest(low (period=mP), kijun_period)) / 2;
def mSpan_B = (Highest(high (period=mP)[kijun_period], 2 * kijun_period) + Lowest(low (period=mP)[kijun_period], 2 * kijun_period)) / 2;
def monthlyCloudLineB = if mSpan_B[-20] == mSpan_B[-21] and
mSpan_B[-21] == mSpan_B[-22] and
mSpan_B[-22] == mSpan_B[-23] and
mSpan_B[-23] == mSpan_B[-24] and
mSpan_B[-24] == mSpan_B[-25] and
mSpan_B[-25] == mSpan_B[-26]
then mSpan_B[-26] else double.NAN;
plot monthly = monthlyCloudLineB[16];