自定义符号。误差、错误、问题、建议。 - 页 31

 

是否有一些机制能够与别人分享一百个自定义字符

历史记录很容易转移 - 只需复制自定义文件夹。但人物规格不清楚。

 
fxsaber:

是否有一些机制能够与别人分享一百个自定义字符

历史记录很容易转移 - 只需复制自定义文件夹。但人物规格不清楚。

我必须编写自定义脚本来上传/下载它们。我不会等待定期出口/进口。

 
Andrey Khatimlianskii:

需要一个自行编写的上传/下载脚本。我不会等待一个常规的导出/导入脚本。

这需要很大的努力,尽管它乍一看很简单。你需要知道设置符号属性 的正确顺序。另外,在报价/交易环节也有麻烦。

也就是说,它需要大量的工作来进行调试,并调试。

 

我在填写新图表上的自定义标记时遇到了问题。我正试图用不同的时间创建一个新的符号图。

但我在填写货币符号的标记时总是遇到问题。

以下是代码。

//+------------------------------------------------------------------+
//|                                         Forward_Ticks_Sample.mq5 |
//|                                                                  |
//|                                                                  |
//+------------------------------------------------------------------+

#property indicator_chart_window
#property indicator_buffers 1
#property indicator_plots 0

#include "Includes//Symbol.mqh"

string   g[];
int      total_len_history = 0,
         initialization_flag,
         symbol_history_wiped_clean,
         len_sym = StringSplit(Symbol(),'_',g);
string   Orig_Symbol_Name = g[0],
         symbol_custom=StringFormat("%s_frd",Orig_Symbol_Name);
datetime Let_start = 0;
bool     alert_once,
         commentplaced;
long     time_msc = long(Let_start)*1000,
         tick_chart_id;
ulong    LastTime_Added;

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int OnInit()
  {
   ResetLastError();
   string name = MQLInfoString(MQL_PROGRAM_NAME);
   IndicatorSetString(INDICATOR_SHORTNAME, name);
   ResetLastError();

   Close_All_Symbols_Charts(symbol_custom);

   MqlTick tick;

   while(SymbolInfoTick(Orig_Symbol_Name, tick) == false)
     {
      Sleep(1000);
     }

   alert_once = false;

   tick_chart_id = 0;

   symbol_history_wiped_clean = Remove_Symbol_From_MarketWatch_Delete_History(symbol_custom);

   alert_once = true;
   initialization_flag = INIT_FAILED;

   return(INIT_SUCCEEDED);
  }
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
int OnCalculate(const int rates_total,
                const int prev_calculated,
                const int begin,
                const double &price[])
  {
   ResetLastError();
   MqlTick tick, ticks[];

   if(symbol_history_wiped_clean == false)
     {
      Close_All_Symbols_Charts(symbol_custom);

      symbol_history_wiped_clean = Remove_Symbol_From_MarketWatch_Delete_History(symbol_custom);

      if(symbol_history_wiped_clean == false)
         return 0;
     }

   if(symbol_history_wiped_clean == true &&
      initialization_flag == INIT_FAILED
     )
     {
      Alert_me();
      if(Fill_ReFill_Custom_Symbol(symbol_custom) == -1)
         return 0;
      initialization_flag = INIT_SUCCEEDED;
      Print("History Filled Successfully.");
      Comment("");
      return rates_total;
     }

   SymbolInfoTick(Orig_Symbol_Name, tick);

//if(tick.time_msc != LastTime_Added)
     {
      ulong tick_count = tick.time_msc - LastTime_Added;
      uint get_count = uint(MathAbs(double(tick_count)));

      int len = CopyTicks(Orig_Symbol_Name, ticks, COPY_TICKS_ALL, LastTime_Added, get_count);

      if(len <= 2)
         return rates_total;

      ulong last_time = ticks[len - 1].time_msc;

      if(len > 5)
        {
         commentplaced = true;
         ChartSetString(tick_chart_id, CHART_COMMENT, "Please wait while we retrieve ticks........");
        }

      int filled = Tick_Filling_Logic(ticks, len);

      if(commentplaced == true && filled > 0)
        {
         if(last_time + 60 > ulong(TimeCurrent()))
           {
            ChartSetString(tick_chart_id, CHART_COMMENT, "");
            Comment("");
            commentplaced = false;
           }
        }

      if(tick_chart_id <= 0)
        {
         tick_chart_id = ChartOpen(symbol_custom, PERIOD_M1);
        }
     }

   return rates_total;
  }
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
void Close_All_Symbols_Charts(string local_symbol)
  {
   tick_chart_id = 0;
   ResetLastError();
   for(long chartid = ChartFirst(); chartid != -1 && !IsStopped(); chartid = ChartNext(chartid))
     {
      string name = ChartSymbol(chartid);

      if(StringFind(name, local_symbol) < 0)
         continue;

      if(!ChartClose(chartid))
         Print("Cannot close Chart Symbol: ", name, " Period: ", EnumToString(ChartPeriod(chartid)));
     }
   Sleep(1000);
  }
//+------------------------------------------------------------------+
bool Remove_Symbol_From_MarketWatch_Delete_History(string local_symbol)
  {
   ResetLastError();

   Sleep(10);
   const SYMBOL SYMB(local_symbol);

   bool custom = true;
   bool status = SYMB.IsExist();//SymbolExist(local_symbol, custom);

   if(status == false)
      return true;

   if(SYMB.Off() == false)
     {
      Print("Cannot UnSelect the Symbol ", local_symbol, " because: ", GetLastError());
      Sleep(5000);
     }

   Print(__FUNCTION__, " : Error = ", GetLastError());

   if(CustomTicksDelete(local_symbol, 0, LONG_MAX) <= 0)
      Print("Cannot Delete Custom Ticks: ", GetLastError());

   return true;
  }
//+------------------------------------------------------------------+
int Fill_ReFill_Custom_Symbol(string local_symbol)
  {
   ResetLastError();
   total_len_history = 0;
   alert_once = false;
   commentplaced  = false;
   LastTime_Added = 0;

   Comment("Refreshing the Tick Chart. Please Wait.");

   MqlDateTime str;
   TimeToStruct(iTime(Orig_Symbol_Name, 0, 0) - 30 * 86400, str);
   Comment("");
   datetime start_date = datetime(StringFormat("%d.%d.01 00:00:00",str.year,str.mon));
   const SYMBOL SYMB(local_symbol);
   SYMB.CloneProperties(Orig_Symbol_Name);


   MqlTick ticks_add[];

   ulong time_start = GetMicrosecondCount();

   ResetLastError();

   if(LastTime_Added == 0)
      LastTime_Added = ulong(start_date) * 1000;

   int len = CopyTicksRange(Orig_Symbol_Name,
                            ticks_add,
                            COPY_TICKS_ALL,
                            LastTime_Added,
                            ulong(TimeCurrent()) * 1000
                           );

   if(len<=0)
     {
      string error;
      if(GetLastError() == 4401)
         error = "ERR_HISTORY_NOT_FOUND";
      else
         error = string(GetLastError());
      Print("------------------------------------------------------------------");
      Print("History Tick Length: ", len, " Error: ", error);
      Print("------------------------------------------------------------------");
      Sleep(5000);
      // Print("Waited for 10000 milliseconds. Still no history found.");
      return -1;
     }

   Let_start = 0;
   time_msc = long(Let_start)*1000;

   int total = Tick_Filling_Logic(ticks_add, len);

   if(total <= 0)
     {
      SYMB.Off();
      CustomSymbolDelete(local_symbol);
      return -1;
     }

   if(GetLastError() == 4403)
     {
      Sleep(2000);
      Print("History Failed to Retrieve.");
      len = -1;
      return len;
     }

   Print("Gathering Ticks from : ", iTime(Orig_Symbol_Name, 0, 0) - 30 * 86400, " To: ", TimeCurrent());
   Print("Symbol Working :",SYMB.On());
   Print("Ticks: ",len);
   Print("Started : ",ticks_add[0].time,"  Ended : ",ticks_add[len-1].time);
   Print("Error Found: ",GetLastError());
   Print("Ticks Filled: ", total);

   Print("Time Required for completion: ",(GetMicrosecondCount()-time_start)/1000000);
   Print("Started : ",ticks_add[0].time,"  Ended : ",ticks_add[len-1].time);
   Print("History Loaded!!!!");
   Print(Let_start);

   Comment("");
   ChartSetString(tick_chart_id, CHART_COMMENT, "");

   return len;
  }
//+------------------------------------------------------------------+
void OnDeinit(const int r)
  {
   EventKillTimer();
  }
//+------------------------------------------------------------------+
void Alert_me()
  {
   if(alert_once == false)
      return;
   Alert(symbol_custom, " : Please Wait for Chart Refresh");
  }
//+------------------------------------------------------------------+
int Tick_Filling_Logic(MqlTick& ticks_add[],
                       int len)
  {
   ResetLastError();

   long last = ticks_add[len - 2].time_msc,
        time_msc_local = time_msc;
   datetime Let_start_local = Let_start;
   int total_len_history_local = total_len_history;

   for(int i=0; i < len - 1 && !IsStopped(); i++)
     {
      if(i == 0 || (i > 0 && iBarShift(Orig_Symbol_Name, PERIOD_M1, ticks_add[i].time) > iBarShift(Orig_Symbol_Name, PERIOD_M1, ticks_add[i + 1].time)))
        {
         Let_start_local = datetime(TimeToString(Let_start_local, TIME_DATE|TIME_MINUTES))
                           + 60;
         MqlDateTime tt1;
         TimeToStruct(Let_start_local, tt1);
         if(tt1.day_of_week == 0)
           {
            Let_start_local = Let_start_local + 86400;
           }
         else
            if(tt1.day_of_week == 6)
              {
               Let_start_local = Let_start_local + 86400*2;
              }
         time_msc_local = long(Let_start_local)*1000;
        }
      else
        {
         if(ticks_add[i].time == ticks_add[i + 1].time)
            time_msc_local = time_msc_local + 1;
         else
           {
            Let_start_local = Let_start_local + 1;
            time_msc_local = long(Let_start_local)*1000;
           }
        }
      ticks_add[i].time       = Let_start_local;
      ticks_add[i].time_msc   = time_msc_local;
      total_len_history_local = total_len_history_local + 1;
     }
   int total = CustomTicksAdd(symbol_custom, ticks_add);

   if(total <= 0)
     {
      Print("Tick Not added : ", GetLastError());
      total = CustomTicksReplace(symbol_custom, ticks_add[0].time_msc, ticks_add[len - 1].time_msc, ticks_add, len);
     }

   if(total == len)
     {
      LastTime_Added    = last;
      Let_start         = Let_start_local;
      time_msc          = time_msc_local;
      total_len_history = total_len_history_local;
     }
   else
     {
      Print("Tick not replaced : ", GetLastError(), " ", len, " = len but filled = ", total, " in ", symbol_custom);
     }
   return total;
  }
//+------------------------------------------------------------------+

我已经附上了依赖性文件。

我得到了这个错误。

请帮助我找到问题所在,以及我到底需要做什么才能使它正常工作。

这个错误意味着我没有填入结构上的复选框。但如果是这样的话,以前的蜡烛怎么会看起来很完美呢?

п

附加的文件:
Symbol.mqh  7 kb
 
jaffer wilson :

我在填写新图表上的自定义标记时遇到了问题。我正试图用不同的时间创建一个新的符号图。

但我在填写货币符号的标记时总是遇到问题。

以下是代码。

我已经附上了依赖性文件。

我得到了这个错误。

请帮助我找到问题所在,以及我到底需要做什么才能使它正常工作。

这个错误意味着我没有填入结构上的复选框。但如果是这样的话,以前的蜡烛怎么会看起来很完美呢?

п

请帮助我处理我的自定义符号代码。我在这个问题上卡住了,我的客户开始生气了。

 
Имеется проблема обновления OHLC в CustomSymbol
Имеется проблема обновления OHLC в CustomSymbol
  • 2021.07.01
  • www.mql5.com
Я пробовал следующий код: Но всегда есть обновление, написанное на диаграмме. Плюс название символа другое в окне спецификации...
 

今天打开终端,下载了2994更新,MT5重新启动。我看到所有的符号都不见了,包括许多自定义的符号。

在bases/Custom文件夹中,我还有历史和ticks文件夹,其中有用于自定义符号的.hc, .hcc, .tkc数据文件,我现在如何使用它们?

警告!我真的需要重新创建自定义符号、导入历史记录等吗?

 
Sunriser:

今天打开终端,下载了2994更新,MT5重新启动。我看到所有的符号都不见了,包括许多自定义的符号。

在bases/Custom文件夹中,我还有历史和ticks文件夹,其中有用于自定义符号的.hc, .hcc, .tkc数据文件,我现在如何使用它们?

警告!我真的需要重新创建自定义符号、导入历史记录等吗?

你可以尝试把自定义文件夹移到另一个位置,然后重新创建符号--规格,没有历史。然后退出终端,复制回自定义文件夹并启动终端。历史应该回升。


要求对终端侧的json字符设置进行备份。意外删除或其他讨厌的事情--从备份恢复。

 
fxsaber:

你可以尝试把自定义文件夹移到另一个位置,然后重新创建符号--规格,没有历史记录。然后退出终端,复制回自定义文件夹并启动终端。历史应该回升。


要求对终端侧的json字符设置进行备份。意外删除或其他讨厌的东西 - 从备份中恢复。

它起作用了。谢谢你节省的时间!

 

关于交易、自动交易系统和测试交易策略的论坛

Custom Sybmol: ERROR 5308

Dark Ride3r, 2021.06.24 09:55

我试图为一个自定义符号设置SYMBOL_VOLUME_MIN,但它返回ERROR 5308

我完全检查了其他参数工作正常,但只有SYMBOL_VOLUME_MIN,我把它的值设置为双倍,返回

err_custom_symbol_parameter_error 5308

因此,我认为这是系统中的一个错误,需要报告,以便能够得到修复。

这是 我用来创建符号并为自定义符号设置属性:SYMBOL_VOLUME_MIN的方法。

(SetProperty(SName, SYMBOL_VOLUME_MIN , 0.001 , "" )