The volume AFL help!


Could anybody help me with writing an AFL that shows the difference between the volume of the up day minus the volume of the down day in the past 20 days?

Thank you.

How about something like this?

isUpDay = C > Ref(C,-1);
upVol = IIf(isUpDay, V, 0);
downVol = IIf(!isUpDay, V, 0);
volDiff20 = Sum(upVol-downVol, 20);

My definition of "up day" is when today's close is higher than yesterday's close. If you have a different definition, you can simply change the assignment of isUpDay.

1 Like

This is what I want. Thank you very much!