How to retrieve the high and low of the last 100 bars of all Major currency pairs via an indicator

 

Dear Metatraders 

I am trying to develop an indicator that show me the highest high and the lowest low of the last 100 bars of all Major currency pairs, 

This is part of my codes:

double dEURUSD[2];
dEURUSD[0] = High[iHighest("EURUSD",PERIOD_CURRENT,MODE_HIGH,100,1)];
dEURUSD[1] = Low [iLowest ("EURUSD",PERIOD_CURRENT,MODE_LOW, 100,1)];
double dEURNZD[2];
dEURNZD[0] = High[iHighest("EURNZD",PERIOD_CURRENT,MODE_HIGH,100,1)];
dEURNZD[1] = Low [iLowest ("EURNZD",PERIOD_CURRENT,MODE_LOW, 100,1)];

For some reason what I am getting is the following:

If I placed this indicator on the EURUSD chart, the high and low of the EURNZD are incorrect,however
If I placed this indicator on the EURNZD chart, the high and low of the EURNZD are correct

Same thing for the high and low of the EURUSD currency pair

Check the image that I shared 

Does anyone know what seems the problem ?

Many thanks

Files:
EURUNZ.png  35 kb
 

High[], Low[] only work for the chart symbol and timeframe. You need to use iHigh and iLow instead.
 
nicholishen:
High[], Low[] only work for the chart symbol and timeframe. You need to use iHigh and iLow instead.

Thanks nicholishen it worked well !!!

Now I am facing another issue when trying to backtest my indicator, 

The Bid and the Ask of the other currency pair are not working

Check the image that I shared.

Any idea how to get the Bid and Ask of another currency pair ?

Many Thanks, 

Files:
EURUNZ.png  37 kb
 
mariogharib:

Thanks nicholishen it worked well !!!

Now I am facing another issue when trying to backtest my indicator, 

The Bid and the Ask of the other currency pair are not working

Check the image that I shared.

Any idea how to get the Bid and Ask of another currency pair ?

Many Thanks, 

You cannot backtest other pairs in MT4, you must use MT5 for that.

 
nicholishen:

You cannot backtest other pairs in MT4, you must use MT5 for that.

You cannot trade other pairs in MT4 Strategy Tester, but you can get prices, if they are available.
 
mariogharib:

Thanks nicholishen it worked well !!!

Now I am facing another issue when trying to backtest my indicator, 

The Bid and the Ask of the other currency pair are not working

Check the image that I shared.

Any idea how to get the Bid and Ask of another currency pair ?

Many Thanks, 

Show your code if you need coding help.
 
nicholishen:

You cannot backtest other pairs in MT4, you must use MT5 for that.

Thanks nicholishen for the tip,

I moved to MT5 and it is working very well, 

I am trying now to execute all type of orders, but in the backtesting it is giving me an [unknown retcode 0] not sure why 

Any idea ?

==========================

#include <Trade\Trade.mqh>
CTrade trade;

double ask = NormalizeDouble(SymbolInfoDouble(_Symbol,SYMBOL_ASK),_Digits);

if(!trade.Buy(1, NULL, ask, 0, 0, "")) {
Print("Buy() method failed. Return code=",trade.ResultRetcode()," Code description: ",trade.ResultRetcodeDescription());
} else {
Print("Buy() method executed successfully. Return code=",trade.ResultRetcode()," (",trade.ResultRetcodeDescription(),")");
}

==========================

Error code: 2018.04.01 16:06:56.445 2018.01.02 10:36:00   Buy() method failed. Return code=0 Code description: unknown retcode 0

 
Alain Verleyen:
Show your code if you need coding help.

Thanks Alain,

I actually re-coded my stuff in MT5, and it is working well, 

I am facing now another issue when trying to execute an order, it is giving me an unknown retcode 0 in the backtesting

==========================

#include <Trade\Trade.mqh>
CTrade trade;

double ask = NormalizeDouble(SymbolInfoDouble(_Symbol,SYMBOL_ASK),_Digits);

if(!trade.Buy(1, NULL, ask, 0, 0, "")) {
Print("Buy() method failed. Return code=",trade.ResultRetcode()," Code description: ",trade.ResultRetcodeDescription());
} else {
Print("Buy() method executed successfully. Return code=",trade.ResultRetcode()," (",trade.ResultRetcodeDescription(),")");
}

==========================

Error code: 2018.04.01 16:06:56.445 2018.01.02 10:36:00   Buy() method failed. Return code=0 Code description: unknown retcode 0

Any idea why ?

Thanks

 
mariogharib:

Thanks Alain,

I actually re-coded my stuff in MT5, and it is working well, 

I am facing now another issue when trying to execute an order, it is giving me an unknown retcode 0 in the backtesting

==========================

#include <Trade\Trade.mqh>
CTrade trade;

double ask = NormalizeDouble(SymbolInfoDouble(_Symbol,SYMBOL_ASK),_Digits);

if(!trade.Buy(1, NULL, ask, 0, 0, "")) {
Print("Buy() method failed. Return code=",trade.ResultRetcode()," Code description: ",trade.ResultRetcodeDescription());
} else {
Print("Buy() method executed successfully. Return code=",trade.ResultRetcode()," (",trade.ResultRetcodeDescription(),")");
}

==========================

Error code: 2018.04.01 16:06:56.445 2018.01.02 10:36:00   Buy() method failed. Return code=0 Code description: unknown retcode 0

Any idea why ?

Thanks

This section is for mql4 question. Please don't mix things.
Reason: