如何使用 MQL4 在图表上创建静态趋势线对象?
每当前 500 根蜡烛中的最高蜡烛高于最近 5 根蜡烛的最高蜡烛时,我想要一条下降趋势线。然而,趋势线是第一次创建但不会更新。
int highestCandle=iHighest(Symbol(),0,MODE_HIGH,500,0);
if(High[highestCandle]>High[5])
{
ObjectCreate(0,"HT",OBJ_TREND,0,Time[highestCandle],High[highestCandle],Time[0],High[0]);
ObjectSetInteger(0,"HT",OBJPROP_COLOR,clrBlue); ObjectSetInteger(0,"HT",OBJPROP_STYLE,STYLE_SOLID); ObjectSetInteger(0,"HT",OBJPROP_RAY,true);
}
我不想删除这个对象并在每个新的价格变动时重新创建,我只想在图表上更新它。
I want a down trend line whenever the highest candle in the previous 500 bars is higher than latest 5 candles highest bar. However the trend line is created the first time but does not update.
int highestCandle=iHighest(Symbol(),0,MODE_HIGH,500,0);
if(High[highestCandle]>High[5])
{
ObjectCreate(0,"HT",OBJ_TREND,0,Time[highestCandle],High[highestCandle],Time[0],High[0]);
ObjectSetInteger(0,"HT",OBJPROP_COLOR,clrBlue); ObjectSetInteger(0,"HT",OBJPROP_STYLE,STYLE_SOLID); ObjectSetInteger(0,"HT",OBJPROP_RAY,true);
}
I do not want to delete this object and recreate on every new tick, I would just like it to be updated on the chart.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
因为您已经创建了对象,所以尝试再次创建它不会移动坐标。您需要使用 objectMove 。尝试以下代码:
Because you have already created your object, trying to create it again will not move the coordinates. You need to use ObjectMove. Try the following code: