Parameter conversion not allowed error message

Lewis Mbuthia Wambugu  

Hi, I compiled a dll in C# to import into my metatrader 5 EA but I get the following error.

Parameter conversion not allowed.

Here's the code:

#import "C:\Program Files\MetaTrader 5\MQL5\Experts\Advisors\bin\Debug\Analytical.dll"
bool Interphase(int argc, string &args[]);
#import


and here's where I try to use the function...

if (Interphase(3, signal)==true)
{
    // Do stuff...
}


I'm new to MQL5 so I don't understand the data type of the signal.

Any help will be appreciated.

Thanks.

Lewis Mbuthia Wambugu  
Alain Verleyen:

Hi, I can't find the\MQL5\Libraries folder, all I have is:

Any ideas?


Lewis Mbuthia Wambugu  
Ok, so I added the dll to my Include folder...
The new code is:
#import "Analytical.dll"
bool Interphase(int argc, string &args[]);
#import
And here's the function call:
if (Interphase(3, CheckPointer(GetPointer(signal)))==true)
   {
     // Do stuff...
   }
when I try to compile it, I get the error message:
'CheckPointer' - parameter passed as reference, variable expected
What now?
Lewis Mbuthia Wambugu  
Alain Verleyen:
You should read the documentation. CheckPointer() doesn't return a bool.

Understood, the problem is I'm used to programming in C# where you can simply declare the currency pairs you wish to trade e.g.
string currencypairs = "AUDCAD, CHFJPY, EURNZD, GBPJPY, TRYJPY, USDSEK, AUDCHF, EURAUD, EURSEK, GBPNZD";

I was wondering if the same was possible in MQL5. Specifically if I could input the currency pairs I wish to trade with a string data type?

Thanks.
Andrew Thompson  
Lewis Mbuthia Wambugu #:

Understood, the problem is I'm used to programming in C# where you can simply declare the currency pairs you wish to trade e.g.

I was wondering if the same was possible in MQL5. Specifically if I could input the currency pairs I wish to trade with a string data type?

Thanks.

This can be done, but then you need to split the string into an array of assets, and loop through the array in your trading logic i.e. building arrays//multidimensional arrays of variables/arrays, and looping through the assets in the various builtin functions in your EA

Tobias Johannes Zimmer  
Lewis Mbuthia Wambugu #:

Understood, the problem is I'm used to programming in C# where you can simply declare the currency pairs you wish to trade e.g.

I was wondering if the same was possible in MQL5. Specifically if I could input the currency pairs I wish to trade with a string data type?

Thanks.
Try this:

string arr_sym[]={"EURUSD","GBPUSD","USDJPY"};

etc.
Andrew Thompson  
insert string arr_sym[]={"EURUSD","GBPUSD","USDJPY"};

is not allowed, and as I understood it was what the OP wanted to do.

instead this is possible, I use the same method in certain multi timeframe scenarios:

input string TradeSymbols = "EURUSD,GBPUSD,USDJPY";
int symbolsnumber;
string currencypairs[];

...
// in OnInit() split assets out from input string into currencypairs array:
symbolsnumber = StringSplit(TradeSymbolsToUse, ',', currencypairs);
// deselect all symbols from market watch:
for(int i = 0; i < SymbolsTotal(false); i++)
     {
      SymbolSelect(SymbolName(i, false), false);
     }
//  then bring back all in currencypairs:
for(int i = 0; i < symbolsnumber; i++)
     {
      SymbolSelect(currencypairs[i], true);
     }  
// Then in OnTick() loop through all assets in currencypairs with your trade logic.
Reason: