AlfyParticipant
Average
Hi guys, i wonder if anyone can help. I’m looking to create a ratio of total volume on up days (close>close [1]) of the last 10 trading days to the volume on the down days in the last 10 trading days. Can anyone help please?
Thanks in advance and best regards
There you go:
//N = 10 //10 bars
UP = summation[N](Volume * (close > close[1]))
DN = summation[N](Volume * (close < close[1]))
//R = UP / DN //simple Ratio
R = UP * 100 / (UP + DN) //%
RETURN R AS "Ratio Up/Down %"
If you import the attached ITF file the variable N is already declared. If you prefer copying & pasting the above code, then uncomment line 1.
You can change the type of ratio simply swapping comments between lines 4 and 5.