Multicurrency experts

Back to topics list To post a new topic, please log in or register
avatar
107
Manel 2015.09.29 11:17
 

I want to implement an MT4 multicurrency expert and I have a problem with Bid and Ask prices for all the symbols (with the exception of the one where the expert is attached). I looked for that in the forum and the answer is that I have to use MarketInfo() but that's exactly what I'm doing...

 I create the pairs array and the indicators (say a 10-EMA):

int n_pairs = 7;
string symbol[7] = {"EURUSD","GBPUSD","USDJPY","USDCHF","NZDUSD","USDCAD","AUDUSD"};   
double  Ema10Current[7];
int start(){
...
   for(j = 0; j < n_pairs; j++){   
      Ema10Current[j]   = iMA(symbol[j],period,10,0,MODE_EMA,PRICE_CLOSE,BarShift);
      string Info = StringConcatenate("Symbol: ", symbol[j]," Bid: ",MarketInfo(symbol[j],MODE_BID)," ;Ask: ",MarketInfo(symbol[j],MODE_ASK), "; Ema10Current: ",Ema10Current[j]);              
      Print(Info);
   }
}

 and I obtain (I attached the expert in the USDCHF chart):

2015.09.29 11:00:58.992 2015.09.27 00:00  Intraday_1min USDCHF,Daily: Symbol: AUDUSD Bid: 0 ;Ask: 0; Ema10Current: 0.7069

2015.09.29 11:00:58.992 2015.09.27 00:00  Intraday_1min USDCHF,Daily: Symbol: USDCAD Bid: 0 ;Ask: 0; Ema10Current: 1.328

2015.09.29 11:00:58.992 2015.09.27 00:00  Intraday_1min USDCHF,Daily: Symbol: NZDUSD Bid: 0 ;Ask: 0; Ema10Current: 0.6335

2015.09.29 11:00:58.992 2015.09.27 00:00  Intraday_1min USDCHF,Daily: Symbol: USDCHF Bid: 0.9779 ;Ask: 0.978; Ema10Current: 0.9742

2015.09.29 11:00:58.992 2015.09.27 00:00  Intraday_1min USDCHF,Daily: Symbol: USDJPY Bid: 0 ;Ask: 0; Ema10Current: 120.3094

2015.09.29 11:00:58.992 2015.09.27 00:00  Intraday_1min USDCHF,Daily: Symbol: GBPUSD Bid: 0 ;Ask: 0; Ema10Current: 1.534

2015.09.29 11:00:58.992 2015.09.27 00:00  Intraday_1min USDCHF,Daily: Symbol: EURUSD Bid: 0 ;Ask: 0; Ema10Current: 1.122

The EMA's are OK (except for the number of decimals maybe) but the return of the Bid and Ask prices are all 0 (except for USDCHF).

What I am doing wrong with EMA10 (number of decimal places) and Bid/Ask prices?

Thank you for any help... 

  

 

avatar
Moderator
3407
GumRai 2015.09.29 11:42 #
 
Make sure that all the symbols you are accessing are in the market watch window.
avatar
107
Manel 2015.09.29 12:30 #
 
GumRai:
Make sure that all the symbols you are accessing are in the market watch window.

Thanks for the answer. 

Yes, they are. In real time it works fine (see below). But in the strategy tester does not.

 I included a new line in the code including digits, spread and minlot:

Info = StringConcatenate("Symbol: ", symbol[j]," Digits: ",MarketInfo(symbol[j],MODE_DIGITS)," ;Spread: ",MarketInfo(symbol[j],MODE_SPREAD), "; MinLot: ",MarketInfo(symbol[j],MODE_MINLOT));           
Print(Info);
 

 and I obtain spread and minlot also zero for all pairs except for the one where I attached the expert. This in the strategy tester (in real time it works fine).

 

 I need to work with the strategy tester. I have the data in the period I selected in the tester (I checked it in the history center). Any idea of the problem I have? 


In real time: 

2015.09.29 12:20:06.215 Intraday_1min EURUSD,M1: Symbol: AUDUSD Digits: 5 ;Spread: 20; MinLot: 0.01

2015.09.29 12:20:06.215 Intraday_1min EURUSD,M1: Symbol: AUDUSD Bid: 0.6982 ;Ask: 0.6984; Ema10Current: 0.698

2015.09.29 12:20:06.215 Intraday_1min EURUSD,M1: Symbol: USDCAD Digits: 5 ;Spread: 18; MinLot: 0.01

2015.09.29 12:20:06.215 Intraday_1min EURUSD,M1: Symbol: USDCAD Bid: 1.3409 ;Ask: 1.3411; Ema10Current: 1.3408

2015.09.29 12:20:06.124 Intraday_1min EURUSD,M1: Symbol: NZDUSD Digits: 5 ;Spread: 30; MinLot: 0.01

2015.09.29 12:20:06.124 Intraday_1min EURUSD,M1: Symbol: NZDUSD Bid: 0.6349 ;Ask: 0.6352; Ema10Current: 0.635

2015.09.29 12:20:06.124 Intraday_1min EURUSD,M1: Symbol: USDCHF Digits: 5 ;Spread: 12; MinLot: 0.01

2015.09.29 12:20:06.124 Intraday_1min EURUSD,M1: Symbol: USDCHF Bid: 0.9728 ;Ask: 0.973; Ema10Current: 0.9724

2015.09.29 12:20:06.124 Intraday_1min EURUSD,M1: Symbol: USDJPY Digits: 3 ;Spread: 12; MinLot: 0.01

2015.09.29 12:20:06.124 Intraday_1min EURUSD,M1: Symbol: USDJPY Bid: 119.898 ;Ask: 119.91; Ema10Current: 119.8988

2015.09.29 12:20:06.124 Intraday_1min EURUSD,M1: Symbol: GBPUSD Digits: 5 ;Spread: 15; MinLot: 0.01

2015.09.29 12:20:06.124 Intraday_1min EURUSD,M1: Symbol: GBPUSD Bid: 1.5189 ;Ask: 1.519; Ema10Current: 1.5189

2015.09.29 12:20:06.123 Intraday_1min EURUSD,M1: Symbol: EURUSD Digits: 5 ;Spread: 12; MinLot: 0.01

2015.09.29 12:20:06.123 Intraday_1min EURUSD,M1: Symbol: EURUSD Bid: 1.1229 ;Ask: 1.1231; Ema10Current: 1.123

 

Back to topics list  

To add comments, please log in or register