Percentage Of Green Days Within 10 Days


Category:
0
0

Hello,

 

I’ve been struggling on how to make a study like this… I want to plot the % of green days in the last 10 days as a lower study.

I define green day when the close is greater than the open on the same daily chart.

 

Example: Let’s say in the last 10 trading days there were 7 green days and 3 red days then “70” should be plotted in the lower study.

 

Any ideas?

 

Thank you!

Marked as spam
Posted by (Questions: 8, Answers: 5)
Asked on April 23, 2020 12:51 pm
72 views
0
Private answer

Should be something like this:

input numberOfDays = 10;
def upBar = close > open;
plot data = Sum(upBar, numberOfDays) / numberOfDays * 100;

I haven't tested it so be sure to let us know how it works.

Marked as spam
Posted by (Questions: 37, Answers: 4118)
Answered on April 23, 2020 4:36 pm