Error testing custom symbol

To add comments, please log in or register
ludoz
45
ludoz  

Hello everyone,

I'm trying to migrate from MetaTrader4 to MetaTrader5. To do that I have created a custom symbol on MT5 and imported M1 and Tick data from Dukas. (Custom symbol named EURUSD_DUKAS)

Everything seems ok, I can see the data on my graph and the ticks are correctly saved in the appropriate folders.

To test that I have created a very very simple EA that place an order at the first tick, and if I run this EA with the strategy tester everything seems ok.

The problem arise if I remove the stop loss from the order. If I do that, I don't know why, when I run the tester I get a huge load of error message like:

2018.03.27 21:55:23.816 Core 1 2018.03.02 08:59:58  no prices for symbol USDEUR_BASKET (2018.03.01 22:49:42 0.00000, 0.00000)

USDEUR_BASKET is a standard symbol that you find hidden on the market watch. But I'm not testing that!! 

It seems that MT5 is trying to mix 2 symbols. My order is placed correctly, but then I get all these errors!

Someone else has the same problem?

My EA is here, but I get the same errors even if I run the example Moving Average EA


screen


//+------------------------------------------------------------------+
//|                                                         Test.mq5 |
//|                                                                  |
//|                                                                  |
//+------------------------------------------------------------------+
#property copyright ""
#property link      ""
#property version   "1.00"

//+------------------------------------------------------------------+
//| Expert initialization function                                   |
//+------------------------------------------------------------------+
int OnInit()
{
   return(INIT_SUCCEEDED);
}
//+------------------------------------------------------------------+
//| Expert deinitialization function                                 |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
{
  
}

bool first = true;

void OnTick()
{     
   if(first)
   {      
      SendBuyOrder(3214123);
      first = false;
   }            
}



uint SendBuyOrder(long const magic_number) 
{ 
   //double stopLoss   = NormalizeDouble(Bid - 100 * _Point, _Digits);
   double Ask = SymbolInfoDouble(_Symbol, SYMBOL_ASK);
   
   //--- prepare a request 
   MqlTradeRequest request={0}; 
   request.action = TRADE_ACTION_DEAL;         // setting a pending order 
   request.magic = magic_number;                  // ORDER_MAGIC 
   request.symbol = _Symbol;                      // symbol 
   request.volume = 0.1;                          // volume in 0.1 lots 
   request.sl = 0;                                // Stop Loss is not specified 
   request.tp = 0;                                // Take Profit is not specified      
   //--- form the order type 
   request.type = ORDER_TYPE_BUY;
   //--- form the price for the pending order 
   request.price= Ask;  // open price 
   //--- send a trade request 
   MqlTradeResult result = {0}; 
   OrderSend(request,result);
   //--- write the server reply to log   
   Print(__FUNCTION__,"ludo :",result.comment); 
   if(result.retcode==10016) Print("errore: ", result.bid,result.ask,result.price); 
   //--- return code of the trade server reply 
   return result.retcode; 
} 
anthony thillerot
39
anthony thillerot  
ludoz:

Hello everyone,

I'm trying to migrate from MetaTrader4 to MetaTrader5. To do that I have created a custom symbol on MT5 and imported M1 and Tick data from Dukas. (Custom symbol named EURUSD_DUKAS)

Everything seems ok, I can see the data on my graph and the ticks are correctly saved in the appropriate folders.

To test that I have created a very very simple EA that place an order at the first tick, and if I run this EA with the strategy tester everything seems ok.

The problem arise if I remove the stop loss from the order. If I do that, I don't know why, when I run the tester I get a huge load of error message like:

2018.03.27 21:55:23.816 Core 1 2018.03.02 08:59:58  no prices for symbol USDEUR_BASKET (2018.03.01 22:49:42 0.00000, 0.00000)

USDEUR_BASKET is a standard symbol that you find hidden on the market watch. But I'm not testing that!! 

It seems that MT5 is trying to mix 2 symbols. My order is placed correctly, but then I get all these errors!

Someone else has the same problem?

My EA is here, but I get the same errors even if I run the example Moving Average EA





Hello everybody i have same problem , pls help me.

Thanks

anthony thillerot
39
anthony thillerot  
anthony thillerot:


Hello everybody i have same problem , pls help me.

Thanks

Hello 

I saw that the problem occurred when I passed a trade.

You have an idea ?
Thx
fxsaber
10231
fxsaber  
ludoz:

Try this.

EA error custom symbol
EA error custom symbol
  • 2018.04.21
  • www.mql5.com
hello, I've created a custom symbol from EUR/USD. In the backtest trades are working good but there are lots of errors "2018.04.21 18:13:02...
ludoz
45
ludoz  

For anyone wondering, I solved the problem.

I have created 2 custom currencies:

  1. EURUSD.1 (here I imported the M1 and tick data that I have)
  2. USDEUR.1 (here I have run a script that have populated the M1 data using the EURUSD.1 data inverted)

That way when backtesting EURUSD.1 the proper currency exchange will be picked up.

If someone want the script to invert the prices let me know.

Dimitar Petkov
15
Dimitar Petkov  
ludoz:

For anyone wondering, I solved the problem.

I have created 2 custom currencies:

  1. EURUSD.1 (here I imported the M1 and tick data that I have)
  2. USDEUR.1 (here I have run a script that have populated the M1 data using the EURUSD.1 data inverted)

That way when backtesting EURUSD.1 the proper currency exchange will be picked up.

If someone want the script to invert the prices let me know.

You no need any script. All you need to do is to set the property's of the CustomSymbol (in your case EURUSD.1):

1. Base currency = EUR

2. Profit currency = USD

3. Margin currency = EUR (seems your account currency is EUR)

Actually you need to clone all the property's of "EURUSD" to the custom "EURUSD.1". You can do this very simply, just follow the steps:

From the main menu -> View -> Symbols -> Find and select "EURUSD". Press the button "Create Custom Symbol". Change the name "EURUSD" to "EURUSD_dukas" by double clicking. Press  the "OK" button. You`ll have now all the property`s of "EURUSD" cloned to "EURUSD_dukas", including swaps, etc. In case you need again to modify it: Right click on "EURUSD_dukas" and choose 'Change Custom Symbol', then modify only the property`s you want to change.

To add comments, please log in or register