EA failure due to micro account suffix--GBPJPYm? - page 2

 
kminler:
thanks for the idea that will be my next step
string GBPJPYm;
OrderSend(GBPJPYm,OP_BUY,lots,Ask,3,SLB,0,"NLAG",501,0,Blue)

This is the code with the actual name inserted, it generates the following messages "symbol name for order send function must be a string"

and last error 4062 ( ERR_STRING_PARAMETER_EXPECTED)

I am sure the line of code is fine, it has worked for other pairs (using Symbol() and two other brokers, the only time it has been an issue is when the "m" for micro account has been added.

I will try MODE_TRADEALLOWED, May take little while to force a real time trade.

 
kminler: thanks for the idea that will be my next step
string GBPJPYm;
OrderSend(GBPJPYm,OP_BUY,lots,Ask,3,SLB,0,"NLAG",501,0,Blue)

This is the code with the actual name inserted, it generates the following messages "symbol name for order send function must be a string"

and last error 4062 ( ERR_STRING_PARAMETER_EXPECTED)


I am sure the line of code is fine, it has worked for other pairs (using Symbol() and two other brokers, the only time it has been an issue is when the "m" for micro account has been added.

I will try MODE_TRADEALLOWED, May take little while to force a real time trade.

You declare the variable but never give it a value.

string GBPJPYm="GBPJPYm";
OrderSend(GBPJPYm,OP_BUY,lots,Ask,3,SLB,0,"NLAG",501,0,Blue)
Thats probably what you intended to do.
 
ubzen:

You declare the variable but never give it a value.

Thats probably what you intended to do.

DUH--Great point!!!

Have amended code and I guess that really illustrates the value of posting actual code.

thanks

Keith

 
kminler:

DUH--Great point!!!

Have amended code and I guess that really illustrates the value of posting actual code.

thanks

Keith

ok great news that works, need to code the actual symbol name and declare it, now trading correctly.

Many thanks to all.

Keith

 
kminler:

ok great news that works, need to code the actual symbol name and declare it, now trading correctly.

Many thanks to all.

Keith


Was the chart you placed the EA also "GBPJPYm" ??

Then you could do it symplie

with

//string GBPJPYm="GBPJPYm";
OrderSend(Symbol(),OP_BUY,lots,Ask,3,SLB,0,"NLAG",501,0,Blue)
 
kminler:

ok great news that works, need to code the actual symbol name and declare it, now trading correctly.


So how did this work before ? you said it did . . .
 
RaptorUK:
So how did this work before ? you said it did . . .

On regular symbol names both NULL and Symbol() work; original code was Symbol().

Bit of a nuisance to have to code for every currency pair, there may be a workaround, probably could use case

or I guess easier way would be to make the symbol name an external variable.

again thanks for your help

 
deVries:


Was the chart you placed the EA also "GBPJPYm" ??

Then you could do it symplie

with

yes the ea was on the GBPJPYm chart and that didn't work, that was the original code and worked for regular symbol names.

Somewhere in the back of my mind I have the idea that names must be upper caseand the lower case "m" was the issue and by declaring the variable you get around that, don't know;

just happy to have the ea working again.

Thanks for your comment.

 
Keith:

On regular symbol names both NULL and Symbol() work; original code was Symbol().

Bit of a nuisance to have to code for every currency pair, there may be a workaround, probably could use case

or I guess easier way would be to make the symbol name an external variable.

again thanks for your help


what code and how did you add it to each currency pair?

 
static input string prefix="";  // prefix
static input string suffix=""; // postfix

string symbol=prefix+Symbol()+suffix;
4 years later but okay...