Creating a custom symbol

 

Hello,

I created a custom symbol following the tutorial here (https://www.mql5.com/en/articles/3540). In the "Bars" tab, I click on "Import Bars", select M1 period and import a CSV file. I click on "Ok", the windows closes.

Then I find my symbol in the "Market Watch" window, right-click and choose "Chart Window". A pop-up opens but keeps showing "Waiting For Update"...

What's the problem?

Thanks in advance,
Mark
PS: I don't know how to insert a screenshot

Creating and testing custom symbols in MetaTrader 5
Creating and testing custom symbols in MetaTrader 5
  • www.mql5.com
Custom symbols in MetaTrader 5 offer new opportunities for developing trading systems and analyzing any financial markets. Now traders are able to plot charts and test trading strategies on an unlimited number of financial instruments. To do this, they only need to create their custom symbol based on a tick or minute history. Custom symbols can...
 

I changed the datetime format from "yyyy-mm-dd hh:mm:ss" to "yyyy.mm.dd hh:mm:ss" but it didn't work better. The bars are saved into the symbol.

Here is an exerpt of my data file:

Time,Open,High,Low,Close,Volume
2018.01.01 22:00:00,1.20143,1.20148,1.20087,1.20112,47.99
2018.01.01 22:05:00,1.20116,1.20144,1.20062,1.20133,135.37
2018.01.01 22:10:00,1.20133,1.20133,1.20102,1.20105,45.67

I selected the option "Ticks volume", otherwise the bars appear as red and I guess it means that they aren't correctly read.

No error pops up, but the import doesn't work. Do you know what the issue is?

 

The contents of the imported data must be as follows:

You must add spreads and real volumes to import correctly.

I will give you a sample to refer to it.


datetime time; 
double    open; 
double    high; 
double    low; 
double    close; 
long        tick_volume;
int          spread; 
long        real_volume; 
Files:
USDJPY.zip  1 kb
 

Thank you so much, I artificially added the 2 missing columns, and it's working now!

But where are the specs of these input files? The format in quite unusual. In general, a financial data file consists in OHLC data + Volume. I don't understand this notion of "Ticks volume".

Moreover, no error is popping up so this is a real flaw in the application...

 
Mark531:

Thank you so much, I artificially added the 2 missing columns, and it's working now!

But where are the specs of these input files? The format in quite unusual. In general, a financial data file consists in OHLC data + Volume. I don't understand this notion of " Ticks volume".

Moreover, no error is popping up so this is a real flaw in the application...

There is no flaw in the application. Note that there is NO problem to import data formatted as you said (so without the additional spread/volume fields) :

2018.01.01 22:00:00,1.20143,1.20148,1.20087,1.20112,47.99
2018.01.01 22:05:00,1.20116,1.20144,1.20062,1.20133,135.37
2018.01.01 22:10:00,1.20133,1.20133,1.20102,1.20105,45.67

But these are M5 data so it will fail to create M1 bars as requested by MT5.

Reading the documentation would help.

I provided you the online link, but the exact same informations are available by pressing F1, which is usual practice for the last 30 years probably.

In case your original data can't easily be formatted with the needed format, the import can be done by code and completely customized.

Custom Financial Instruments - For Advanced Users - MetaTrader 5 Help
Custom Financial Instruments - For Advanced Users - MetaTrader 5 Help
  • www.metatrader5.com
The trading platform allows creating custom financial symbols. You can view charts of such symbols and perform technical analysis, as well as use them for testing trading robots and indicators in the Strategy Tester. If your broker does not provide the instrument, on which you want to test your strategy, or the provided history depth and the...
 

I'm writing a script to register custom symbols.

First, I created a test script like this:

//+------------------------------------------------------------------+
//|                                                  Test Script.mq5 |
//|                                                    Naguisa Unada |
//|                         https://www.mql5.com/en/users/unadajapon |
//+------------------------------------------------------------------+
#property copyright "Naguisa Unada"
#property link      "https://www.mql5.com/en/users/unadajapon"
#property version   "1.00"
#property script_show_inputs
//--- input parameters
input string   symbol_0 = "6758";               //Symbol code
//+------------------------------------------------------------------+
//| Script program start function                                    |
//+------------------------------------------------------------------+
void OnStart()
{
//---
   string group_name;
   long  number;
   bool  ret;
   bool  is_custom      = true;

   number = StringToInteger(symbol_0);
   number = (long)(MathFloor(number / 1000) * 1000);
   group_name = IntegerToString(number);

   if (!SymbolExist(symbol_0, is_custom))
   {
      ret = CustomSymbolCreate(symbol_0, group_name, NULL);

      if (!ret)
      {
         Alert("Failed to create symbol for " + symbol_0);
      }
      else
      {
         CustomSymbolSetString(symbol_0, SYMBOL_DESCRIPTION, "SONY");
         CustomSymbolSetString(symbol_0, SYMBOL_CATEGORY, "Electric");
         CustomSymbolSetString(symbol_0, SYMBOL_EXCHANGE, "Tokyo-1");
      }
   }

   MessageBox("All work have been completed.", "完了", MB_OK);
//---
}
//+------------------------------------------------------------------+

"Symbol" and "Description" are registered as shown in the picture, however, "Category" and "Exchange" are not registered.

What is wrong with me?

CustomSymbol

 
Naguisa Unada:

I'm writing a script to register custom symbols.

First, I created a test script like this:

"Symbol" and "Description" are registered as shown in the picture, however, "Category" and "Exchange" are not registered.

What is wrong with me?


That's an MT5 bug. Reported.
 
Alain Verleyen:
That's an MT5 bug. Reported.

All right. Thanks.

Reason: