I hope that this is okay for me to post this and ask for the conversion.
Looking to convert this indicator I found on TradingView into PRT.
Little bit of background: A distribution day is defined as ” a down day and a loss of more than 0.2% by an index and volume is higher than the day before”. This idea comes from William O’Neal and his book “How to make money in stocks”.
A count of 5+ distribution days in a period of 20-25 days/bars usually shows that the pros are taking some money off the table.
Below is the code I found on TradingView:
//@version=3
study(“Distribution Days”, overlay=true)
cnt = 0
is_distribution = false
if(isdaily)
len = input(25, minval=1, title=”Tage”)
is_down_bar = change(close) < (close[1] * -0.002) ? true : false
is_volume_up = change(volume) > 0 ? true : false
is_distribution := is_down_bar and is_volume_up ? true : false
for i = 0 to len
if(is_distribution[i])
cnt := cnt + 1
plotchar(series=(is_distribution?cnt:false), char=’D’, color=white)
I was also hoping that the days input to be rollover 25 days from close of current day rather than 25 days from last Distribution Day
Hope this is clear.
Thanks in advance.