首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何将无界振荡器转换为0到100之间的有界振荡器?

如何将无界振荡器转换为0到100之间的有界振荡器?
EN

Stack Overflow用户
提问于 2022-10-17 09:49:47
回答 1查看 30关注 0票数 0

你知道如何在0到100之间把无限的振荡器变成有限的振荡器吗?

例如,如何绑定动量指示器

代码语言:javascript
复制
mom = close - close[10]
plot(mom, color=#2962FF, title="MOM")
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2022-10-17 09:55:48

您可以使用解释为normalize()这里函数。

代码语言:javascript
复制
// ————— When the scale of the signal to rescale is unknown (unbounded).
// Min/Max of signal to rescale is determined by its historical low/high.
normalize(_src, _min, _max) =>
    // Normalizes series with unknown min/max using historical min/max.
    // _src      : series to rescale.
    // _min, _min: min/max values of rescaled series.
    var _historicMin =  10e10
    var _historicMax = -10e10
    _historicMin := min(nz(_src, _historicMin), _historicMin)
    _historicMax := max(nz(_src, _historicMax), _historicMax)
    _min + (_max - _min) * (_src - _historicMin) / max(_historicMax - _historicMin, 10e-10)
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/74095425

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档