Request to add trend lines on AccumDistBuyPr

S

shanc

New member
Greetings,
On the AccumDistBuyPr indicator, I'm trying to generate two auto trendlines with extensions from the last two highs if the current bar close is lower and from the last two lows if the current bar close is higher. Unfortunately, I couldn't figure out how to fetch the previous high/low to connect and create the trendline. Attached is the example screenshot and thinkscipt code. I have color-coded AccumDistBuyPr to show if the current bar is lower/higher than the previous bar. I've been drawing the trendlines manually and it's tiresome. 😅 . Any help is much appreciated. Great day to all.



Code:
#added ColorCode - ShancR
declare lower;

def data = if close > close[1] then close - Min(close[1], low) else if close < close[1] then close - Max(close[1], high) else 0;

plot AccDist = TotalSum(data);

AccDist.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
AccDist.DefineColor("Up", GetColor(1));
AccDist.DefineColor("Down", GetColor(0));
AccDist.AssignValueColor(if AccDist > AccDist[1] then AccDist.color("Up") else AccDist.color("Down"));
 
A

ashfordtrader

New member
I would like to use the same logic for these trend lines but for a price chart. Can you please help?
 
S

shanc

New member
Hi @ashfordtrader , I won't be of any help as I'm seeking it as well.:ROFLMAO:. I hope others will be able to help both of us out with these trendlines. Good day.
 

Similar threads

Top