Metatrader 4 上的 DLL 不会随传入报价更新

发布于 2024-11-17 12:55:51 字数 635 浏览 2 评论 0原文

我编写了一个简单的 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

ま柒月 2024-11-24 12:55:51

对于新柱唯一的事情,我的技术是将最后一个柱的 (Bars[0]) 日期时间信息保留在变量中,如果它发生了变化,这意味着新柱已经到来。

datetime lastBarDateTime;

int start(){
    if(Time[0]==lastBarDateTime)
    return(0);

    lastBarDateTime = Time[0];

    // codes to run on a new bar ...
}

对于 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.

datetime lastBarDateTime;

int start(){
    if(Time[0]==lastBarDateTime)
    return(0);

    lastBarDateTime = Time[0];

    // codes to run on a new bar ...
}

For DLL part, I actually couldn't have understood where you are using DLL in that code.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文