初学者的问题 MQL5 MT5 MetaTrader 5 - 页 1387

 
我是Atamurat Abdukayimov,去年当我安装mt5应用程序时,我接到一个号码+998339667671的电话,打到我的旧号码+998975221951,现在已经停用了,我可以和她沟通吗?
 

下午。

我正在重做一个标准的MACD。

//+------------------------------------------------------------------+
//|                                                         MACD.mq5 |
//|                   Copyright 2009-2020, MetaQuotes Software Corp. |
//|                                              http://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright   "2009-2020, MetaQuotes Software Corp."
#property link        "http://www.mql5.com"
#property description "Moving Average Convergence/Divergence"
#include <MovingAverages.mqh>
//--- indicator settings
#property indicator_separate_window
#property indicator_buffers 4
#property indicator_plots   2
#property indicator_type1   DRAW_HISTOGRAM
#property indicator_type2   DRAW_LINE
#property indicator_color1  Silver
#property indicator_color2  Red
#property indicator_width1  2
#property indicator_width2  1
#property indicator_label1  "MACD"
#property indicator_label2  "Signal"
//--- input parameters
input int                InpFastEMA=12;               // Fast EMA period
input int                InpSlowEMA=26;               // Slow EMA period
input int                InpSignalSMA=9;              // Signal SMA period
input ENUM_APPLIED_PRICE InpAppliedPrice=PRICE_CLOSE; // Applied price
//--- indicator buffers
double ExtMacdBuffer[];
double ExtSignalBuffer[];
double ExtFastMaBuffer[];
double ExtSlowMaBuffer[];

int    ExtFastMaHandle;
int    ExtSlowMaHandle;
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
void OnInit()
  {
//--- indicator buffers mapping
   SetIndexBuffer(0,ExtMacdBuffer,INDICATOR_DATA);
   SetIndexBuffer(1,ExtSignalBuffer,INDICATOR_DATA);
   SetIndexBuffer(2,ExtFastMaBuffer,INDICATOR_CALCULATIONS);
   SetIndexBuffer(3,ExtSlowMaBuffer,INDICATOR_CALCULATIONS);
//--- sets first bar from what index will be drawn
   PlotIndexSetInteger(1,PLOT_DRAW_BEGIN,InpSignalSMA-1);
//--- name for indicator subwindow label
   string short_name=StringFormat("MACD(%d,%d,%d)",InpFastEMA,InpSlowEMA,InpSignalSMA);
   IndicatorSetString(INDICATOR_SHORTNAME,short_name);
//--- get MA handles
   ExtFastMaHandle=iMA(NULL,0,InpFastEMA,0,MODE_EMA,InpAppliedPrice);
   ExtSlowMaHandle=iMA(NULL,0,InpSlowEMA,0,MODE_EMA,InpAppliedPrice);
  }
//+------------------------------------------------------------------+
//| Moving Averages Convergence/Divergence                           |
//+------------------------------------------------------------------+
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[])
  {
   if(rates_total<InpSignalSMA)
      return(0);
//--- not all data may be calculated
   int calculated=BarsCalculated(ExtFastMaHandle);
   if(calculated<rates_total)
     {
      Print("Not all data of ExtFastMaHandle is calculated (",calculated," bars). Error ",GetLastError());
      return(0);
     }
   calculated=BarsCalculated(ExtSlowMaHandle);
   if(calculated<rates_total)
     {
      Print("Not all data of ExtSlowMaHandle is calculated (",calculated," bars). Error ",GetLastError());
      return(0);
     }
//--- we can copy not all data
   int to_copy;
   if(prev_calculated>rates_total || prev_calculated<0)
      to_copy=rates_total;
   else
     {
      to_copy=rates_total-prev_calculated;
      if(prev_calculated>0)
         to_copy++;
     }
//--- get Fast EMA buffer
   if(IsStopped()) // checking for stop flag
      return(0);
   if(CopyBuffer(ExtFastMaHandle,0,0,to_copy,ExtFastMaBuffer)<=0)
     {
      Print("Getting fast EMA is failed! Error ",GetLastError());
      return(0);
     }
//--- get SlowSMA buffer
   if(IsStopped()) // checking for stop flag
      return(0);
   if(CopyBuffer(ExtSlowMaHandle,0,0,to_copy,ExtSlowMaBuffer)<=0)
     {
      Print("Getting slow SMA is failed! Error ",GetLastError());
      return(0);
     }
//---
   int start;
   if(prev_calculated==0)
      start=0;
   else
      start=prev_calculated-1;
//--- calculate MACD
   for(int i=start; i<rates_total && !IsStopped(); i++)
      ExtMacdBuffer[i]=ExtFastMaBuffer[i]-ExtSlowMaBuffer[i];
//--- calculate Signal
   SimpleMAOnBuffer(rates_total,prev_calculated,0,InpSignalSMA,ExtMacdBuffer,ExtSignalBuffer);
//--- OnCalculate done. Return new prev_calculated.
   return(rates_total);
  }
//+------------------------------------------------------------------+

添加一个符号变量。

Symbol1

变化

   ExtFastMaHandle=iMA(NULL,0,InpFastEMA,0,MODE_EMA,InpAppliedPrice);
   ExtSlowMaHandle=iMA(NULL,0,InpSlowEMA,0,MODE_EMA,InpAppliedPrice);

敬请关注。

   ExtFastMaHandle=iMA(Symbol1,0,InpFastEMA,0,MODE_EMA,InpAppliedPrice);
   ExtSlowMaHandle=iMA(Symbol1,0,InpSlowEMA,0,MODE_EMA,InpAppliedPrice);

结果在日志中出现了一个错误:没有计算ExtFastMaHandle的所有数据(20057条)。错误 4806

而且不会呈现指标。我试图从代码中删除检查和返回(0)。

   if(calculated<rates_total)
     {
      Print("Not all data of ExtFastMaHandle is calculated (",calculated," bars). Error ",GetLastError());
      return(0);
     }

и

   if(calculated<rates_total)
     {
      Print("Not all data of ExtSlowMaHandle is calculated (",calculated," bars). Error ",GetLastError());
      return(0);
     }

我在我的日志中得到。

获得快速EMA是失败的!错误 4807

是不是因为所附指标的图表上的条数与Ima获得数据的图表上的条数不同?

如何优化修改代码,MACD是针对选定的符号计算的,而不是针对附在图表上的符号?

 
Sergey #:

下午好。

我正在重做一个标准的MACD。

添加一个符号变量。

变化

敬请关注。

结果在日志中出现了一个错误:没有计算ExtFastMaHandle的所有数据(20057条)。错误 4806

而且不会呈现指标。我试图从代码中删除检查和返回(0)。

и

我在我的日志中得到。

获得快速EMA是失败的!错误 4807

是不是因为所附指标的图表上的条数与Ima获得数据的图表上的条数不同?

如何改变MACD的代码,以计算所选符号的MACD,而不是计算它在图表中所连接的符号?

使用帮助示例:iMACD

 
Vladimir Karputov #:

使用参考例子:iMACD

谢谢你!

 

大家好!

,我在FXCM开了一个账户,MT5没有货币对的符号,也没有图表,链接https://www.metatrader5.com/ru/news/1372,说MT5是用FXCM的报价定制的

。你能告诉我从哪里开始或者告诉我哪个经纪人使用FXCM的报价吗?


如果我想在FXCM进行交易,我应该下载手册并像这里一样进行。



提前感谢您的答复...

 

如何从WinAPI函数'GetLastError'获得代码?我想用WinAPI函数DeleteFileW来删除一个不存在的文件。

根据DeleteFileW的 帮助,如果

... приложение пытается удалить несуществующий файл, функция DeleteFile завершается с ошибкой ERROR_FILE_NOT_FOUND. Если файл доступен только для чтения, функция завершается с ошибкой ERROR_ACCESS_DENIED

代码描述 'ERROR_FILE_NOT_FOUND

错误_文件未找到

2 (0x2)

系统无法找到指定的文件。


也就是说,当我试图删除一个不存在的文件时,我应该得到一个 "2",但我得到的是 "0"。


我的脚本代码。

//+------------------------------------------------------------------+
//|                                                   DeleteFile.mq5 |
//|                              Copyright © 2022, Vladimir Karputov |
//|                      https://www.mql5.com/en/users/barabashkakvn |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2022, Vladimir Karputov"
#property link      "https://www.mql5.com/en/users/barabashkakvn"
#property version   "1.00"
#property script_show_inputs
#include <WinAPI\errhandlingapi.mqh>
#include <WinAPI\fileapi.mqh>
//--- input parameters
input string   InpFileName="C:\\123.txt";
//+------------------------------------------------------------------+
//| Script program start function                                    |
//+------------------------------------------------------------------+
void OnStart()
  {
//---
   ResetLastError();
   int result=DeleteFileW(InpFileName);
   uint res=GetLastError();
   if(result==0)
      PrintFormat("DeleteFile failed (%d)",res);
   else
      PrintFormat("DeleteFile OK (%d)",res);
  }
//+------------------------------------------------------------------+

执行结果。

DeleteFile failed (0)
附加的文件:
 
下午好,建议陷入骗子的伎俩,通过注册在他们的方向上MT5对我的帐户被注册在***存钱,给了一个小赚现在不能撤回,该网站的经纪人我没有通过注册,但写了一封信,以支持,我做什么,如何提取他们的钱建议请
 
val511 #:
你好,请告诉我,我上了骗子的当。 我按照他们的指示在MT5注册,但我在***注册了账户,我赚了一些钱,现在我不能取钱。 我没有在经纪人网站上注册,但我给支持部门发了一封邮件,我应该怎么做,如何取钱,请告诉我。

MQL5.com与任何经纪公司都没有关系。MQL5.com的支持只有在您将钱存入您的MQL5账户(val511)时,才能在网站上回复。

 
我明白了,也许你能给我一些建议。 我将非常感激。
 
val511 #:
我明白了,也许你能给我一些建议。 我将非常感激。

给警察写一份声明。