新人对MQL4和MQL5的任何问题,对算法和代码的帮助和讨论 - 页 868

 
Alexandr Sokolov:

这是我的代码。


检查过了,一切正常,要么是你改错了代码,要么是编译错了,要么是 ...好吧,重设终端或什么的,但它肯定在工作。

 
Igor Makanu:

检查过了,一切正常,要么是你改错了代码,要么是编译错了,要么是......。你可能想重新启动终端,但它肯定在工作。

我已经不止一次地检查了所有的东西。如果你想确定 - 我可以通过TeamViever向你展示

 
Alexandr Sokolov:

我已经不止一次地检查了所有的东西。如果你想确定--我可以通过TeamViever向你展示一切。

你最好(另外)将代码作为文件附在信息中--就像文本中一样,代码没有设计(没有头),也不清楚代码是用于哪个终端。

 
Alexandr Sokolov:

以下是我的代码


你有一个外部的uint。你想要什么?那么,请仔细阅读答案。
 
Vladimir Karputov:

你最好(另外)将代码作为文件附在信息中--因为在文本中,代码没有格式化(没有标题),而且不清楚代码是用于哪个终端。

附加的文件:
test.mq5  1 kb
 
Alexandr Sokolov:

mt5中的extern 不显示,只有输入。而且

 
Vitaly Muzichenko:

mt5中的extern 不显示,只有输入。


现在我明白了,我是在寻找一个错误

 
Alexandr Sokolov:

这是一个正确创建的指标--有一个头,没有 "strict"--它们在MQL5中不需要,没有 "extern"--这是上个世纪的事情,而指标不显示任何东西,我们马上表示缓冲区的数量 "0 "和结构的数量 "0"。

#property indicator_buffers 0
#property indicator_plots   0

下面是整个代码。

//+------------------------------------------------------------------+
//|                                                         Test.mq5 |
//|                              Copyright © 2019, Vladimir Karputov |
//|                                           http://wmua.ru/slesar/ |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2019, Vladimir Karputov"
#property link      "http://wmua.ru/slesar/"
#property version   "1.000"
#property indicator_chart_window
#property indicator_buffers 0
#property indicator_plots   0
//--- input parameters
input uint x=10; // X
input uint y=20; // Y
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int OnInit()
  {
//--- 
   return(INIT_SUCCEEDED);
  }
//+------------------------------------------------------------------+
//| 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[])
  {

//--- return value of prev_calculated for next call
   return(rates_total);
  }
//+------------------------------------------------------------------+

再往下看,我们可以从这段代码中跳舞。



附加的文件:
Test.mq5  4 kb
 
Vladimir Karputov:

这是一个正确创建的指标--有一个头,没有 "strict"--它们在MQL5中不需要,没有 "extern"--这是上个世纪的 事情,而指标不显示任何东西,我们指定缓冲区的数量为 "0",构造的数量为 "0"。

下面是整个代码。

你可以在这个假人身上进一步跳舞。

这不是上个世纪--这是一个非常酷的事情。

输入 不能改变,你必须重新分配,这很疯狂。使用extern 没有这样的问题,唯一的问题是,由于某些原因,它在mt5中不起作用。

 
Vitaly Muzichenko:

这不是上个世纪的事--它真的很酷。

输入 不能被改变--你必须重新分配,这很疯狂。使用extern 没有这样的问题,唯一的问题是,由于某些原因,它在mt5中不起作用。

帮助中写明了它的用途。是的,用户输入的参数不能以编程方式改变,这一点是正确的。至少可以有属于用户的东西 :)