Prev HLC on Expansion Indicator for ThinkOrSwim

Welkin

Welkin

Active member
VIP
I like to find ways to remove clutter from the charts so I came up with this. Figured others might find it appealing as well. Plots previous day's high, low and close, as well as the current days open on expansion. these values are taken from the daily aggregation.



Code:
#[email protected]
def NA = Double.NaN;

input agg = AggregationPeriod.DAY;
input spaceBetween = 1;

plot currentOpen;
plot prevDayClose;
plot prevDayLow;
plot prevDayHigh;
def exp = IsNaN(close[spaceBetween]);

currentOpen = if exp then open("period"=agg) else NA;
prevDayClose = if exp then close("period"=agg)[1] else NA;
prevDayLow = if exp then low("period"=agg)[1] else NA;
prevDayHigh = if exp then high("period"=agg)[1] else NA;

currentOpen.SetDefaultColor(Color.WHITE);
prevDayLow.SetDefaultColor(Color.RED);
prevDayHigh.SetDefaultColor(Color.GREEN);
prevDayClose.SetDefaultColor(Color.YELLOW);
currentOpen.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
prevDayLow.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
prevDayHigh.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
prevDayClose.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
 
BenTen

BenTen

Administrative
Staff
VIP
This is an interesting way of doing it. I usually have mine right on the current day. Having it on expansion makes the chart cleaner.
 
Thread starter Similar threads Forum Replies Date
H Bollinger Band Contraction/Expansion Questions 2
M ECI (Expansion Contraction Indicator) Questions 5

Similar threads

Top