mql4 - 如何将标签移到当前蜡烛上?
问题描述
#property strict
#property indicator_chart_window
int OnInit(){
if( ObjectFind("MyLabel") == -1)
ObjectCreate(0, "MyLabel", OBJ_LABEL, 0, 0, 0);
return(INIT_SUCCEEDED);
}
void OnDeinit(const int reason){
if( ObjectFind("MyLabel") >=0 )
ObjectDelete(0, "MyLabel");
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int OnCalculate(const int rates_total,
const int prev_calculated,
const datetime &time[],
const double &open[],
const double &high[],
const double &low[],
const double &close[],
const long &tick_volume[],
const long &volume[],
const int &spread[])
{
ObjectSetText( "MyLabel", "$"+DoubleToString(((Close[0]-Close[4])*10000),1), 12, "Times New Roman", clrBlue);
ObjectMove( "MyLabel", OBJ_TEXT, Time[0], Close[0]);
return(rates_total);
}
我想将 72.9 美元移动到我放置红色箭头的当前蜡烛,不仅我希望标签立即移动到当前蜡烛,新蜡烛出现?
提前谢谢你
解决方案
您已经创建了一个 Label 对象,它的属性是 x 和 y。您应该创建文本对象(使用 OBJ_TEXT),以便您可以在时间/价格轴上移动它
推荐阅读
- android - 无法从 SDCARD Android 应用程序读取文件
- c# - 在非异步 asp.net 页面中调用异步方法
- sql - 使用 SQL Developer 格式将日期时间导入 Oracle DB -“6/26/2018 12:41:00 PM”
- php - 如何发布数据,并使用 Laravel 将其插入数据库?
- javascript - Why is this function youWin not working properly?
- python - 在 Azure jupyter notebook 中安装 TA-LIB,面临 GCC 和未创建轮子的问题
- java - 如果 java 堆内存限制与 kubernetes 中的 pod 资源限制不同,会发生什么?
- php - Symfony CMF 链路由器:尽管路由匹配,但出现 404 错误
- sql - 为什么我不能在我的存储过程 deleteByMonth 中插入我的表变量,尽管查询会产生结果?
- ios - 将 UIImage 转换为 4 位颜色空间