Plot AccDist value from the 52 week low


Category:
0
0

Hi Pete!

Here is what i’m trying to do.  I’m simply trying to get the AccDist value from the date of the 52 weekly low.

 

I know how to get the AccDist from another post on here (so TYVM).

def accDist = TotalSum(volume * CloseLocationValue());

I also know how to get the yearly low.

def fiveDayLow = Lowest(low, 252);

 

But what I can’t put together is how to get the AccDist value from the date of the Lowest(252).

 

Hope this makes sense!!

Marked as spam
Posted by (Questions: 10, Answers: 15)
Asked on April 26, 2020 5:59 pm
38 views
0
Private answer

You posted this in the "Stock Scanners" topic but I don't see anything in your question that results in a scan. So I moved this to the "Chart Studies" topic.

I had to read several times, but what I think you are asking is how to plot the value of the AccDist indicator that appears on the bar that is the lowest low stock price in the past 52 weeks.

If this is correct, here is the solution:

def yearlyLowPrice = Lowest(low, 251);
def accDist = TotalSum(volume * CloseLocationValue());
def accDistAtLowestLow = if low == yearlyLowPrice then accDist else 0;
plot accDistValue = HighestAll(accDistAtLowestLow);

This code will fail under two conditions. First is if you do not have a full year of data available on the chart. Second is there just happens to be more than one low equal to the 52 week low.

Marked as spam
Posted by (Questions: 37, Answers: 4087)
Answered on April 26, 2020 6:58 pm
0
Thanks Pete! Yeah my question wasn't the best, I left out the rest of the scanner I was working on because I left if I could get that value I might be able to finish the rest.
( at April 27, 2020 5:05 am)