Skip to content

Conversation

@jasonl99
Copy link
Contributor

@jasonl99 jasonl99 commented Jul 16, 2024

For the mfi indicator:

If no trading days for the period were negative, we'd end up with a divisor of zero, causing with a divide by zero error.

The change here is to set the money_flow_ratio to positive_period_flows (a float) when there are no negative flows for the period

The ratio calculation for money flows over the period is positive_period_flows / negative_period_flows, with both flows representing the sum of the dollar value traded over the days in the period.

While modifying the values, the if statement also checks if positive_period_flows is zero just to short circuit division (since it's unnecessary if the numerator is zero).

@jasonl99 jasonl99 closed this Jul 16, 2024
@jasonl99 jasonl99 reopened this Jul 16, 2024
@mvonlintel mvonlintel merged commit e9efc2c into master Jul 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants