Looking to make this script MTF, just entering the aggregation period with an agg for OHLC isn't working.
Code:
### Previous Candle ###
def last = if isnan(close[-1]) and !isnan(close) then barnumber() else last[1];
def hilo = if hl2 then barnumber() else hilo[1];
def cond = if barNumber() == hilo then barNumber()-1 else double.nan;
def pbar = if barNumber() >= HighestAll(cond) and !last then 1 else double.nan;
input show50 = yes;
plot HalfBack = if show50 and !isnan(pbar) then hl2 else double.nan;
HalfBack.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
HalfBack.SetDefaultColor(color.Yellow);
HalfBack.SetLineWeight(3);
def hbext = if isnan(halfback) then hbext[1] else halfback;
plot hbextline = hbext;
hbextline.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
hbextline.SetDefaultColor(color.Yellow);
hbextline.SetLineWeight(3);
input show75 = yes;
plot Back75 = if show75 and !isnan(pbar) then low+(high-low)*.75 else double.nan;
Back75.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
Back75.SetDefaultColor(color.white);
Back75.SetLineWeight(1);
input show25 = yes;
plot Back25 = if show25 and !isnan(pbar) then low+(high-low)*.25 else double.nan;
Back25.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
Back25.SetDefaultColor(color.white);
Back25.SetLineWeight(1);
input bubblemover = 1;
def n1 = bubblemover + 1;
input showbubble_candle = no;
input showbubble_expansion = no;
addchartBubble(showbubble_candle and barnumber()==highestall(last-1),high,"H: " +high,color.white,yes);
addchartBubble(showbubble_candle and barnumber()==highestall(last-1),low,"L: " +low,color.white,no);
addchartBubble(showbubble_expansion and isnan(close[bubblemover]) and !isnan(close[n1]),high[n1+1],"H: " +high[n1+1],color.white,yes);
addchartBubble(showbubble_expansion and isnan(close[bubblemover]) and !isnan(close[n1]),low[n1+1],"L: " +low[n1+1],color.white,no);
def h1 = if isnan(close) then h1[1] else high[1];
plot h1p = if barnumber()>=highestall(last) then h1 else double.nan;
h1p.setpaintingStrategy(PaintingStrategy.HORIZONTAL);
h1p.setdefaultColor(color.white);
input showcolor_light_gray = yes;
h1p.assignvalueColor(if showcolor_light_gray then color.Black else color.white);
def l1 = if isnan(close) then l1[1] else low[1];
plot l1p = if barnumber()>=highestall(last) then l1 else double.nan;
l1p.setpaintingStrategy(PaintingStrategy.HORIZONTAL);
l1p.setdefaultColor(color.white);
l1p.assignvalueColor(if showcolor_light_gray then color.Black else color.white);
[USER=3357]@MerryDay[/USER] I even added the entire MTF script you provided yesterday. Using the Four_Hours timeframe the 50% level does not appear in the correct location on a smaller TF (1m) any recommendations?
input agg = AggregationPeriod.FOUR_HOURS ;
def close = close(period = agg);
def open= open(period = agg);
def high= high(period = agg);
def low= low(period = agg);
def volume= volume(period = agg);
def hl2= hl2(period = agg);
def hlc3= hlc3(period = agg);
def ohlc4= ohlc4(period = agg);
Last edited: