Plot horizontal line across previous day’s high low for inside bars


Category:
0
0

Hello Pete,

How can I plot a horizontal line across previous day’s high and low, if it was an inside bar.

Thanks in advance

Attachments:
RESOLVED
Marked as spam
Posted by (Questions: 3, Answers: 4)
Asked on January 8, 2019 1:39 pm
176 views
0
Private answer

Here is the code:

def insideBar = high < high[1] and low > low[1];
AssignPriceColor(if insideBar then Color.WHITE else Color.CURRENT);
plot insideHigh = if insideBar then high else if insideBar[1] then high[1] else Double.NaN;
insideHigh.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
insideHigh.SetDefaultColor(Color.CYAN);
insideHigh.SetLineWeight(3);
plot insideLow = if insideBar then low else if insideBar[1] then low[1] else Double.NaN;
insideLow.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
insideLow.SetDefaultColor(Color.MAGENTA);
insideLow.SetLineWeight(3);

Screenshot below shows the result.

Attachments:
Marked as spam
Posted by (Questions: 37, Answers: 4118)
Answered on January 13, 2019 9:20 am
0

Thanks a lot Pete. It works exactly as I wanted. Thanks a lot once again.

( at January 14, 2019 1:34 pm)