欢迎访问 外汇EA下载与MT4/MT5自动交易资源 - 聚合外汇EA、黄金EA、量化交易工具与自动化交易实战内容。
登录 注册

两条线的交点 - MetaTrader 4 脚本

author emer | 894 人阅读 | 0 人评论 |

The intersections of two lines - script for MetaTrader 4

The intersections of two lines - script for MetaTrader 4

The intersections of two lines - script for MetaTrader 4

The intersections of two lines - script for MetaTrader 4

The intersections of two lines - script for MetaTrader 4

朋友问了一个问题,这成了我回忆多年前数学课的借口! 😊(然后说高中算术和几何有什么用;这是同一门课非常实用的例子😉)

在 MetaTrader 4 中,我们打算使用 MQL4 计算具有不同斜率的两个直线对象的交点坐标。

我将给出一个一般性的解释:

如果图表的横轴表示时间 X,图表的纵轴表示价格 Y。对于图表上每条有两个点或距其一个点的线以及该线的斜率,求出这两条线的方程。

最后我们得到了一组方程,通过数学计算并将一个变量写在另一个变量上并将其替换为另一个函数,给出了 X 和 Y 的值,它们是两条线的交点的坐标。

我尝试用几行简单干净的代码来解决问题,这也具有教育意义,我还放下了源代码文件。

The intersections of two lines - script for MetaTrader 4

The intersections of two lines - script for MetaTrader 4

The intersections of two lines - script for MetaTrader 4

通过谷歌翻译进行翻译。

电报:@JahanChart


附件下载

📎 the_intersections_of_two_lines.mq4 (2.05 KB)

Source: MQL5 #32982

🔐
请登录后参与评论
注册满12小时后评论,即可解锁附件下载
立即登录