Taking what you gave me, it was pretty straightforward to put it all together. I made a completely new study to remove clutter. Since Tinkan and Kijun’s are defined in each set, it seemed like it would be ok to do it this way.
<pre>
input tenkan_period = 9;
input kijun_period = 26;
#THIRTY MINUTE LINES
def tenkanthirty = (Highest(high(period = AggregationPeriod.THIRTY_MIN), tenkan_period) + Lowest(low(period = AggregationPeriod.THIRTY_MIN), tenkan_period)) / 2;
def kijunthirty = (Highest(high(period = AggregationPeriod.THIRTY_MIN), kijun_period) + Lowest(low(period = AggregationPeriod.THIRTY_MIN), kijun_period)) / 2;
def “Span AThirty” = (tenkanthirty[0] + kijunthirty[0]) / 2;
def “Span BThirty” = (Highest(high(period = AggregationPeriod.THIRTY_MIN)[0], 2 * kijun_period) + Lowest(low(period = AggregationPeriod.THIRTY_MIN)[0], 2 * kijun_period)) / 2;
rec spanALastThirty = CompoundValue(1, if IsNaN(close[-1]) and !IsNaN(close) then “Span AThirty”[-kijun_period] else spanALastThirty[1], Double.NaN);
rec spanBLastThirty = CompoundValue(1, if IsNaN(close[-1]) and !IsNaN(close) then “Span BThirty”[-kijun_period] else spanBLastThirty[1], Double.NaN);
plot trackSpanAThirty = spanALastThirty;
trackSpanAThirty.SetPaintingStrategy(PaintingStrategy.DASHES);
trackSpanAThirty.AssignValueColor(if spanALastThirty > spanBLastThirty then Color.YELLOW else Color.RED);
plot trackSpanBThirty = spanBLastThirty;
trackSpanBThirty.SetPaintingStrategy(PaintingStrategy.DASHES);
trackSpanBThirty.AssignValueColor(if spanALastThirty > spanBLastThirty then Color.YELLOW else Color.RED);
#ONE HOUR LINES
def tenkanonehour = (Highest(high(period = AggregationPeriod.HOUR), tenkan_period) + Lowest(low(period = AggregationPeriod.HOUR), tenkan_period)) / 2;
def kijunonehour = (Highest(high(period = AggregationPeriod.HOUR), kijun_period) + Lowest(low(period = AggregationPeriod.HOUR), kijun_period)) / 2;
def “Span AOnehour” = (tenkanonehour[0] + kijunonehour[0]) / 2;
def “Span BOnehour” = (Highest(high(period = AggregationPeriod.HOUR)[0], 2 * kijun_period) + Lowest(low(period = AggregationPeriod.HOUR)[0], 2 * kijun_period)) / 2;
rec spanALastOnehour = CompoundValue(1, if IsNaN(close[-1]) and !IsNaN(close) then “Span AOnehour”[-kijun_period] else spanALastOnehour[1], Double.NaN);
rec spanBLastOnehour = CompoundValue(1, if IsNaN(close[-1]) and !IsNaN(close) then “Span BOnehour”[-kijun_period] else spanBLastOnehour[1], Double.NaN);
plot trackSpanAOnehour = spanALastOnehour;
trackSpanAOnehour.SetPaintingStrategy(PaintingStrategy.DASHES);
trackSpanAOnehour.AssignValueColor(if spanALastOnehour > spanBLastOnehour then Color.YELLOW else Color.RED);
plot trackSpanBOnehour = spanBLastOnehour;
trackSpanBOnehour.SetPaintingStrategy(PaintingStrategy.DASHES);
trackSpanBOnehour.AssignValueColor(if spanALastOnehour > spanBLastOnehour then Color.YELLOW else Color.RED);
</pre>
So you say you want horizontal lines plotted across the chart that track the right-most values of Span A and Span B. I am guessing you want those lines to plot to the left, extending into the current price on the chart. Yes? Do you need them to plot any further back then the current price?
I’m thinking something like the way the lines are drawn when you use the draw tool to mark a price level. So yea, ideally it would extend all the way to the left. I think we’re talking about the same thing?