Errors, bugs, questions - page 3154

 
Wizard #:

Got it. And if I don't want to use NormalizePrice function of CSymbolInfo class (I try to avoid libraries, if possible), is there an alternative?

Apply it only when needed, not every sneeze.

 
Wizard #:

I want to make a drop-down list of currency pairs and instruments (own pairs) in the EA input settings window. How it can be done?

//+------------------------------------------------------------------+
//|                                                    InputList.mq5 |
//|                                  Copyright 2021, MetaQuotes Ltd. |
//|                                             https://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2021, MetaQuotes Ltd."
#property link      "https://www.mql5.com"
#property version   "1.00"

//------------------------------------
enum ENUM_SYMBOL 
{
   EURUSD, 
   GBPUSD, 
   JPYUSD
};

//------------------------------------
input ENUM_SYMBOL EnumSymbol = EURUSD;  //Выбери символ

//------------------------------------
void OpenChart(ENUM_SYMBOL symbol) 
{
   switch(symbol)
   {
      case EURUSD: ChartSetSymbolPeriod(0, "EURUSD", PERIOD_CURRENT); break;
      case GBPUSD: ChartSetSymbolPeriod(0, "GBPUSD", PERIOD_CURRENT); break;
      case JPYUSD: ChartSetSymbolPeriod(0, "JPYUSD", PERIOD_CURRENT); break;   
      default: return;
   }
}

//+------------------------------------------------------------------+
//| Expert initialization function                                   |
//+------------------------------------------------------------------+
int OnInit()
{
   OpenChart(EnumSymbol);

   //ChartSetSymbolPeriod() выполняется асинхронно
   //Поэтому тут придумываем ожидание, на прогрузку истории
   //Sleep() тут просто для примера
   Sleep(5000);

   return(INIT_SUCCEEDED);
}

//+------------------------------------------------------------------+
//| Expert deinitialization function                                 |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
{

}

//+------------------------------------------------------------------+
//| Expert tick function                                             |
//+------------------------------------------------------------------+
void OnTick()
{

}
Wizard #:

How would it be correct to write...

double stop = NormalizeDouble(SymbolInfoDouble(_Symbol, SYMBOL_ASK) - 100*_Point, _Digits);
 
Vitaly Muzichenko #:

Only use it when you need it, not every sneeze.

Well, thank you for the advice.

 
Roman #:

Thank you from the bottom of my heart! It's useful not to have to enter the instrument name every time) So enum, switch and case should all be there, all together.

 

Comrades moderators, please move the posts to the "Questions from Beginners" section.

This is the section about bugs, bugs and their solutions.

 
Hello, I have connection problems, after starting the terminal mt5 connection is disconnected in about 20 tries. this happens after reconnecting to the internet, the broker says all is ok.
 

Is there any way to find out what the latest version of .NET is supported by MetaEditor (C# DLL import)?

What are the plans to update it?

Forum on trading, automated trading systems and trading strategy testing

How to report an error in MT5?

bot, 2022.02.09 12:54

I would like to know the general process of reporting an error in MT5.


I have created a dotnet6.0 C# DLL. MetaEditor can find the DLL functions and the code compiles fine, but MT5 does not find the necessary functions inside the DLL.

Note that this problem does not occur with a very old version of the C# DLL.

How can I report this to MT5 support?

Thanks


 

MetaQuotes.


 


Can you tell me what else Metatrader can read instead of csv?

//+------------------------------------------------------------------+
//|                                                          WST.mq5 |
//|                           Copyright © 2009, WallStreetTrader Pro |
//|                                 https://wallstreettraderpro.com/ |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2009, WST"
#property link      "https://wallstreettraderpro.com/"
#include <stdlib.mqh>
#property indicator_separate_window
#property indicator_buffers 8
//---- input parameters
extern string    файл_данных1=".csv";
extern string    подпись1="";
extern color     цвет1=Red;
extern string    файл_данных2=".csv";
extern string    формат_даты="dd.mm.yyyy";
extern string    разделитель_записей=";";
extern string    разделитель_целой_и_дробной=",";

//---- buffers
double FA1[];
double FA2[];
double FA3[];
double FA4[];
double FA5[];
double FA6[];
double FA7[];
double FA8[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
string id;
int init()
  {
   MathSrand((int)TimeLocal());
   for(;;)
   {
      id=StringConcatenate("Fundamental data (id_",MathRand(),")");
      if(WindowFind(id)<0) break;
   }
   IndicatorShortName(id);
//---- indicators
   if(FileCanOpen(файл_данных1))
   {
      if(StringTrimLeft(StringTrimRight(подпись1))=="")
         подпись1=StringSubstr(файл_данных1,0,StringFind(файл_данных1,"."));
   }
   else подпись1="";      
   if(FileCanOpen(файл_данных2))
   {
   if(StringTrimLeft(StringTrimRight(подпись2))=="")
      подпись2=StringSubstr(файл_данных2,0,StringFind(файл_данных2,"."));
   }
   else подпись2="";      
   if(FileCanOpen(файл_данных3))
   {
   if(StringTrimLeft(StringTrimRight(подпись3))=="")
      подпись3=StringSubstr(файл_данных3,0,StringFind(файл_данных3,"."));
   }
   else подпись3="";      
   if(FileCanOpen(файл_данных4))
   {
   if(StringTrimLeft(StringTrimRight(подпись4))=="")
      подпись4=StringSubstr(файл_данных4,0,StringFind(файл_данных4,"."));
   }
   else подпись4="";      
   if(FileCanOpen(файл_данных5))
   {
   if(StringTrimLeft(StringTrimRight(подпись5))=="")
      подпись5=StringSubstr(файл_данных5,0,StringFind(файл_данных5,"."));
   }
   else подпись5="";      
   if(FileCanOpen(файл_данных6))
   {
   if(StringTrimLeft(StringTrimRight(подпись6))=="")
      подпись6=StringSubstr(файл_данных6,0,StringFind(файл_данных6,"."));
   }
   else подпись6="";      
   if(FileCanOpen(файл_данных6))
   {
   if(StringTrimLeft(StringTrimRight(подпись7))=="")
      подпись7=StringSubstr(файл_данных7,0,StringFind(файл_данных7,"."));
   }
   else подпись7="";      
   if(FileCanOpen(файл_данных8))
   {
   if(StringTrimLeft(StringTrimRight(подпись8))=="")
      подпись8=StringSubstr(файл_данных8,0,StringFind(файл_данных8,"."));
   }
   else подпись8="";      
      
   SetIndexStyle(0,DRAW_LINE,STYLE_SOLID,1,цвет1);
   SetIndexLabel(0,подпись1);
   SetIndexBuffer(0,FA1);
   SetIndexStyle(1,DRAW_LINE,STYLE_SOLID,1,цвет2);
   SetIndexLabel(1,подпись2);
   SetIndexBuffer(1,FA2);
   SetIndexStyle(2,DRAW_LINE,STYLE_SOLID,1,цвет3);
   SetIndexLabel(2,подпись3);
   SetIndexBuffer(2,FA3);
   SetIndexStyle(3,DRAW_LINE,STYLE_SOLID,1,цвет4);
   SetIndexLabel(3,подпись4);
   SetIndexBuffer(3,FA4);
   SetIndexStyle(4,DRAW_LINE,STYLE_SOLID,1,цвет5);
   SetIndexLabel(4,подпись5);
   SetIndexBuffer(4,FA5);
   SetIndexStyle(5,DRAW_LINE,STYLE_SOLID,1,цвет6);
   SetIndexLabel(5,подпись6);
   SetIndexBuffer(5,FA6);
   SetIndexStyle(6,DRAW_LINE,STYLE_SOLID,1,цвет7);
   SetIndexLabel(6,подпись7);
   SetIndexBuffer(6,FA7);
   SetIndexStyle(7,DRAW_LINE,STYLE_SOLID,1,цвет8);
   SetIndexLabel(7,подпись8);
   SetIndexBuffer(7,FA8);
//----
   return(0);
 
murziks #:


Can you tell me what else Metatrader can read instead of csv?

.txt

But I prefer it without the extension


Reason: