Metatrader 4 上的 DLL 不会随传入报价更新
我编写了一个简单的 DLL 作为 Metatrader 4 自定义指标的一部分,其名称如下:
int start( ) {
double Rates[][6];
int MaximumRecords = ArrayCopyRates( Rates, Symbol(), 0 );
for( int zz = MaximumRecords; zz >= 0; zz-- ) {
OutPut[zz] = EMPTY;
}
GetSMAArray( Rates, MaximumRecords, Periods, OutPut );
return(0);
}
这工作正常,因为它按照预期在图表上绘制,但不幸的是它不会用新的传入报价进行更新 - 它只是绘制它的初始调用。我还可以添加哪些代码来使 DLL 通过传入的报价进行更新?几乎我所有的搜索都提出了使用
ExtCountedBars = IndicatorCounted();
强制 while
循环进行计算的变体,但这些都适用于 .mq4 文件本身中包含的计算。我想强制DLL重新计算。其次,我希望这种重新计算仅在柱完成时发生,而不是在所有价格变动到达时发生。
I have written a simple DLL as part of a custom indicator for Metatrader 4, which is called thus:
int start( ) {
double Rates[][6];
int MaximumRecords = ArrayCopyRates( Rates, Symbol(), 0 );
for( int zz = MaximumRecords; zz >= 0; zz-- ) {
OutPut[zz] = EMPTY;
}
GetSMAArray( Rates, MaximumRecords, Periods, OutPut );
return(0);
}
This works fine in that it plots as expected on the chart, but unfortunately it does not update with new, incoming ticks - it just plots on its initial call. What further code can I add to make the DLL update with incoming ticks? Almost all my searches have come up with variations on the use of
ExtCountedBars = IndicatorCounted();
to force a while
loop to calculate, but these all apply to calculations contained in the .mq4 file itself. I want to force the DLL to recalculate. Secondly, I would like this recalculation to occur only on the completion of a bar and not on the arrival of all and every tick.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
对于新柱唯一的事情,我的技术是将最后一个柱的 (Bars[0]) 日期时间信息保留在变量中,如果它发生了变化,这意味着新柱已经到来。
对于 DLL 部分,我实际上无法理解您在代码中的何处使用 DLL。
For the on new bar only thing, I technique is to keep last bar's (Bars[0]) date time information in a variable, and if it has changed, this means a new bar has come.
For DLL part, I actually couldn't have understood where you are using DLL in that code.