You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
atr calculate in a wrong way, should not get the new one from last result
if period_values.size == period
if output.empty?
atr = ArrayHelper.average(period_values)
else
atr = (output.last.atr * (period - 1.0) + tr) / period.to_f
end
output << AtrValue.new(date_time: v[:date_time], atr: atr)
period_values.shift
end
prev_price = v
end
you should just re-calculate the average of period_values like this
if period_values.size == period
atr = ArrayHelper.average(period_values)
output << AtrValue.new(date_time: v[:date_time], atr: atr)
period_values.shift
end
prev_price = v
end
The text was updated successfully, but these errors were encountered:
atr calculate in a wrong way, should not get the new one from last result
you should just re-calculate the average of period_values like this
The text was updated successfully, but these errors were encountered: