MarketInfo() producing 0.0 for bid price

 

Hi All 


I'm running the below on EURNZD. While on this pair, I'm trying to get the bid price for another currency pair; GBPNZD (string newcurrency in my EA)

The 1st Print shows me I'm successfully generating GBPNZD, but when I plug this into MarketInfo to get the Bid price of GBPNZD, it is only printing 0.0.

I have both currencies in the Market Watch window. I've also tried simply typing "GBPNZD" into the MarketInfo, and it still only prints a value of 0.0 in the 2nd Print line.

Please could someone help?

        string basecurrency="GBP";
   string newcurrency=StringConcatenate(basecurrency,StringSubstr(Symbol(),3,3));
   Print("My new currency is", newcurrency);
   double newcurrencyBid=MarketInfo(newcurrency,MODE_BID);
   Print("Converter value is", newcurrencyBid);

I'm in backtest, not sure if this affects things.


Many thanks

Steve

 
lancastersteve:

Hi All 


I'm running the below on EURNZD. While on this pair, I'm trying to get the bid price for another currency pair; GBPNZD (string newcurrency in my EA)

The 1st Print shows me I'm successfully generating GBPNZD, but when I plug this into MarketInfo to get the Bid price of GBPNZD, it is only printing 0.0.

I have both currencies in the Market Watch window. I've also tried simply typing "GBPNZD" into the MarketInfo, and it still only prints a value of 0.0 in the 2nd Print line.

Please could someone help?

I'm in backtest, not sure if this affects things.


Many thanks

Steve


Maybe you don't have history data from GBPNZD . so it got no data at all . 

 

Hi


I checked, I definitely have the historical data for GBPNZD 

 
lancastersteve:

Hi


I checked, I definitely have the historical data for GBPNZD 

Yes , I tried to get some data from another pair , also got no result also . :(
Reason: