mql4 - MT4 Expert Advisor EA 更新离线图表价格的问题
问题描述
以下脚本使用计时器,在正常图表中运行良好,每 1 秒在图表上评论当前蜡烛收盘价。但是,在离线图表上,它只加载一次收盘价,并且不会每秒更新一次。这是代码:
void OnTimer()
{
int m=TimeSeconds(TimeLocal());
double CloseValue = Close[0]; //Current Candle Close Value
string CloseValueString = DoubleToString(CloseValue,5); //Current price
Comment(
"Current value :",CloseValueString,"\n",
"Candle time :",m
);
}
解决方案
通过添加 Refreshrates() 函数来解决,该函数在我的函数末尾更新离线图表的数据:
void OnTimer()
{
int m=TimeSeconds(TimeLocal());
double CloseValue = Close[0]; //Current Candle Close Value
string CloseValueString = DoubleToString(CloseValue,5); //Current price
Comment(
"Current value :",CloseValueString,"\n",
"Candle time :",m
);
RefreshRates();
}
推荐阅读
- javascript - 在数组中推送一个新值时,它会被完全覆盖 - VUEX
- python - 函数返回 None 但它应该返回一个字符串,可能很傻
- javascript - setState 方法未设置状态
- ssl - 无法在 Windows 10 中打开端口 8443
- python - django 中没有名为“ecommerce.store”的模块
- version-control - 如何切换到整个项目的旧版本?
- html - 无法使容器溢出-x 可滚动
- flutter - 日期倒计时显示额外时间
- python - python获取具有条件的excel单元格的子字符串
- android - 应该如何在 kotlin 的片段中使用 findViewById?