hi guys, i have an indicator that plot previous day's high/ low and overnight high/ low on the chart. its chart bubbles on these lines keep moving along with the current time.
so my problem is that when price goes close to one of these lines it is engulfed by the bubbles. so is there a way to move these bubbles to either a few bars to the left or right of the current bar? thanks
Without your code, here is an example that has a bubblemover input that you can use to move the bubbles left/right.
Ruby:input time = {default Day, Week, Month, Year}; input displace = 1; input bubblemover = 11; def n = bubblemover; def n1 = n + 1; input rthbegin = 0930; input rthend = 1600; def pastOpen = If((SecondsTillTime(rthbegin) > 0), 0, 1); def pastClose = If((SecondsTillTime(rthend) > 0), 0, 1); def marketOpen = If(pastOpen and !pastClose, 1, 0); def firstBar = If (GetDay()[1] != GetDay(), GetDay() - 1, 0); def h = high; def l = low; def o = open; def c = close; rec rthHigh = If(h > rthHigh[1] and marketOpen, h, If(marketOpen and !firstBar, rthHigh[1], h)); rec rthLow = If(l < rthLow[1] and marketOpen, l, If(marketOpen and rthLow[1] > 0 and !firstBar, rthLow[1], l)); plot PH = high(period = time)[displace]; plot PL = low(period = time)[displace]; plot PC = close(period = time)[displace]; plot TO = open(period = time); plot PP = PivotPoints().pp; plot HD = if marketOpen then rthHigh else Double.NaN; plot LD = if marketOpen then rthLow else Double.NaN; plot MD = (rthHigh + rthLow) / 2; input showhlcloud = no; AddCloud(if showhlcloud then h + 10 else Double.NaN, HD, Color.DARK_GREEN); AddCloud(if showhlcloud then LD else Double.NaN, l - 10 , Color.DARK_RED); PH.SetDefaultColor(Color.GREEN); PH.SetStyle(Curve.MEDIUM_DASH); PH.SetLineWeight(2); PH.HideBubble(); PL.SetDefaultColor(Color.RED); PL.SetStyle(Curve.MEDIUM_DASH); PL.SetLineWeight(2); PL.HideBubble(); PC.SetDefaultColor(Color.YELLOW); PC.SetStyle(Curve.LONG_DASH); PC.SetLineWeight(2); PC.HideBubble(); TO.SetDefaultColor(Color.WHITE); TO.SetStyle(Curve.LONG_DASH); TO.SetLineWeight(2); TO.HideBubble(); PP.SetDefaultColor(Color.WHITE); PP.SetStyle(Curve.SHORT_DASH); PP.SetLineWeight(2); PP.HideBubble(); HD.SetDefaultColor(Color.GREEN); HD.SetStyle(Curve.SHORT_DASH); HD.SetLineWeight(2); HD.HideBubble(); LD.SetDefaultColor(Color.RED); LD.SetStyle(Curve.SHORT_DASH); LD.SetLineWeight(2); LD.HideBubble(); MD.SetDefaultColor(Color.MAGENTA); MD.SetStyle(Curve.POINTS); MD.SetLineWeight(2); MD.HideBubble(); input showbubbles = yes; def StartPlot = if showbubbles == yes then (IsNaN(c[n]) and !IsNaN(c[n1])) else Double.NaN; AddChartBubble(StartPlot, Round(PH[n1], 2), "PH-" + Round(PH[n1], 2), Color.GREEN, yes); AddChartBubble(StartPlot, Round(PL[n1], 2), "PL-" + Round(PL[n1], 2), Color.RED, yes); AddChartBubble(StartPlot, Round(TO[n1], 2), "TO-" + Round(TO[n1], 2), Color.WHITE, yes); AddChartBubble(StartPlot, Round(PP[n1], 2), "PP-" + Round(PP[n1], 2), Color.WHITE, yes); AddChartBubble(StartPlot, Round(PC[n1], 2), "PC-" + Round(PC[n1], 2), Color.YELLOW, yes); AddChartBubble(StartPlot, Round(HD[n1], 2), "HD-" + Round(HD[n1], 2), Color.GREEN, yes); AddChartBubble(StartPlot, Round(LD[n1], 2), "LD-" + Round(LD[n1], 2), Color.RED, no); AddChartBubble(StartPlot, Round(MD[n1], 2), "MD-" + Round(MD[n1], 2), Color.MAGENTA, no); def hdcloud = if IsNaN(c) then hdcloud[1] else HD; plot hdcloud1 = if !IsNaN(c) then Double.NaN else hdcloud; def phcloud = if IsNaN(c) then phcloud[1] else PH; plot phcloudl = if !IsNaN(c[12]) then Double.NaN else phcloud; def plcloud = if IsNaN(c) then plcloud[1] else PL; plot plcloudl = if !IsNaN(c[12]) then Double.NaN else plcloud; def ldcloud = if IsNaN(c) then ldcloud[1] else LD; plot ldcloudl = if !IsNaN(c[12]) then Double.NaN else ldcloud; def pccloud = if IsNaN(c) then pccloud[1] else PC; plot pccloudl = if !IsNaN(c[12]) then Double.NaN else pccloud; AddCloud(hdcloud1, phcloudl, Color.GREEN, Color.GREEN); AddCloud(phcloudl, pccloudl, Color.LIGHT_GREEN, Color.LIGHT_GREEN); AddCloud(pccloudl, plcloudl, Color.LIGHT_RED, Color.LIGHT_RED); AddCloud(plcloudl, ldcloudl, Color.RED, Color.RED);