<<No prices>> error for dummies. Get your copy here!

 

Hey dudes,

This is a limited edition guide on How to get "No prices" on MetaTrader5.

The support didn't answer again to my ticket, so I decided to post my guide.

1. Make sure you have all symbols activated: right click in Market Watch, then point to "Show all".

2. Make an EA with the following code:

//+------------------------------------------------------------------+
//|                                                NoPricesError.mq5 |
//|                        Copyright 2010, MetaQuotes Software Corp. |
//|                                              http://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2010, MetaQuotes Software Corp."
#property link      "http://www.mql5.com"
#property version   "1.00"

input bool GenerateError=false;


int pairscount=0;
string Pairs[100];
//+------------------------------------------------------------------+
//| Expert initialization function                                   |
//+------------------------------------------------------------------+
int OnInit()
  {
   string crtsymbol;
   if (GenerateError==true)
     {
      for (int i=0;i<SymbolsTotal(false);i++)
         {
          crtsymbol=SymbolName(i,false);
          if (SymbolInfoInteger(crtsymbol,SYMBOL_TRADE_CALC_MODE)==SYMBOL_CALC_MODE_FOREX&&StringLen(crtsymbol)>=6)
            {    
             Pairs[pairscount]=crtsymbol;         
             pairscount++;
            }
         }
      }
   else
      {
       Pairs[0]="EURUSD";
       Pairs[1]="GBPUSD";
       Pairs[2]="USDCHF";
       Pairs[3]="USDJPY";
       Pairs[4]="USDCAD";
       Pairs[5]="AUDUSD";
       Pairs[6]="AUDNZD";
       Pairs[7]="AUDCAD";
       Pairs[8]="AUDCHF";
       Pairs[9]="AUDJPY";
       Pairs[10]="CHFJPY";
       Pairs[11]="EURGBP";
       Pairs[12]="EURAUD";
       Pairs[13]="EURCHF";
       Pairs[14]="EURJPY";
       pairscount=15;                   
      }
   return(0);
  }
//+------------------------------------------------------------------+
//| Expert deinitialization function                                 |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
  {
//---
   
  }
//+------------------------------------------------------------------+
//| Expert tick function                                             |
//+------------------------------------------------------------------+
void OnTick()
  {
   for (int i=0;i<pairscount;i++)
      {
       SymbolSelect(Pairs[i],true);
       Print("Tickvalue of ",Pairs[i]," is ",SymbolInfoDouble(Pairs[i],SYMBOL_TRADE_TICK_VALUE));
      }
  }
//+------------------------------------------------------------------+

3. Then put the EA to work on a currency of choice: I made it on EURUSD, M1, last month testing.

 

At the first run, with GenerateError set to false, you'll get stuff like:

2010.08.26 16:38:39 Core 1 2010.08.02 07:22:03 Tickvalue of AUDCHF is 0.9617141593175679
2010.08.26 16:38:39 Core 1 2010.08.02 07:22:03 Tickvalue of AUDCAD is 0.9740322989110321
2010.08.26 16:38:39 Core 1 2010.08.02 07:22:03 Tickvalue of AUDNZD is 0.7283900000000001
2010.08.26 16:38:39 Core 1 2010.08.02 07:22:03 Tickvalue of AUDUSD is 1
2010.08.26 16:38:39 Core 1 2010.08.02 07:22:03 Tickvalue of USDCAD is 0.9740322989110321
2010.08.26 16:38:39 Core 1 2010.08.02 07:22:03 Tickvalue of USDJPY is 1.155641843479869

 We have no goddamn error!

4. Switch the GenerateError value to true and test again:

2010.08.26 16:40:52 Core 1 2010.08.02 01:12:30 Tickvalue of EURUSD is 1
2010.08.26 16:40:52 Core 1 2010.08.02 01:12:30 Tickvalue of EURRUR is 0
2010.08.26 16:40:52 Core 1 no prices for symbol USDRUR
2010.08.26 16:40:52 Core 1 no prices for symbol USDRUR
2010.08.26 16:40:52 Core 1 2010.08.02 01:12:30 Tickvalue of EURNZD is 0
2010.08.26 16:40:52 Core 1 no prices for symbol NZDUSD
2010.08.26 16:40:52 Core 1 no prices for symbol NZDUSD
2010.08.26 16:40:52 Core 1 2010.08.02 01:12:30 Tickvalue of EURJPY is 0
2010.08.26 16:40:52 Core 1 no prices for symbol USDJPY
2010.08.26 16:40:52 Core 1 no prices for symbol USDJPY
2010.08.26 16:40:52 Core 1 2010.08.02 01:12:30 Tickvalue of EURGBP is 0
2010.08.26 16:40:52 Core 1 no prices for symbol GBPUSD
2010.08.26 16:40:52 Core 1 no prices for symbol GBPUSD
2010.08.26 16:40:52 Core 1 2010.08.02 01:12:30 Tickvalue of EURCHF is 0
2010.08.26 16:40:52 Core 1 no prices for symbol USDCHF
2010.08.26 16:40:52 Core 1 no prices for symbol USDCHF
2010.08.26 16:40:52 Core 1 2010.08.02 01:12:30 Tickvalue of EURCAD is 0
2010.08.26 16:40:52 Core 1 no prices for symbol USDCAD
2010.08.26 16:40:52 Core 1 no prices for symbol USDCAD
2010.08.26 16:40:52 Core 1 2010.08.02 01:12:30 Tickvalue of EURAUD is 0
2010.08.26 16:40:52 Core 1 no prices for symbol AUDUSD
2010.08.26 16:40:52 Core 1 no prices for symbol AUDUSD
2010.08.26 16:40:52 Core 1 2010.08.02 01:12:30 Tickvalue of CHFJPY is 0
2010.08.26 16:40:52 Core 1 no prices for symbol USDJPY
2010.08.26 16:40:52 Core 1 no prices for symbol USDJPY
2010.08.26 16:40:52 Core 1 2010.08.02 01:12:30 Tickvalue of CADCHF is 0

Here it goes! Your handmade "No prices" error! Cheers!



 

 
No fixes ? Dissapointing, MQ!
 
I managed to reproduce the error also with the second block, if the RUR pairs are added.
 

try without

if (SymbolInfoInteger(crtsymbol,SYMBOL_TRADE_CALC_MODE)==SYMBOL_CALC_MODE_FOREX&&StringLen(crtsymbol)>=6)

 
vasya_vasya:

try without


If I try without that, It will serve the stocks to the procedure that has to make a list of currencies (in the original EA), and the point is to have only forex. Another condition might check if the first character is "#" , but that's unprofessional too, because at some point in future there might be futures or something else lacking the "#" in the front. SYMBOL_TRADE_CALC_MODE is a real smart thing, and I really think that opening a defective pair (like EURRUR or USDRUR) is making the error to appear. You can't put the condition to not work with the RUR, because at the time it gets in the condition it already opens it for working and blows up.

 

We are working on it.

Just wait for a while. 

 
Never mind, skipped with a "manual" block.  Are you guys looking at OnTrade() too ? 
 
alexvd:

We are working on it.

Just wait for a while. 

Four years later...

I got the same error: 

Symbols no prices for symbol USDBRL 

And I found out why!

Seems like historic data before 2010.09.07 was broken for USDBRL.

Who would've thought eh! 

 

And Five years on …

after spending way too much time trying to find the problem with the code, trying to find why 'no prices for symbol'

changed base currency from AUD to USD and no problem

Hope this helps save someone some hours :p

Reason: