a problem about EA only when running in living trading

 

Code is as below: When Signal is 1, and Orders numbers traded by this EA is 0, then send OP_BUY order; this is very simple logic.

now I have attached this EA to demo account and living account, what is surprising is that:

at the same time, this EA only trades one order on demo account and trades many orders on living account, what is the matter?

some people tell me that this is because my living account is related to another account; when my account trade an order, in the fact, my account does nothing, but the related account trades really; does it?

thanks!

int start()

{

int Signal=..........

Orders_CNT=Orders_Number(); // get the orders number which traded by this EA

if( Orders_CNT == 0 )

{

if( Signal == 1 )

{

iWait();

........

int Order_Ticket= OrderSend(Symbol(),OP_BUY,Lots,Ask,Slip*Pips_Slip,Stop_Loss,TP,0,Magic_Number,0,0);
if(Order_Ticket < 0) Print("OrderSend() failed: ",ErrorDescription(GetLastError()));

}}}
int Orders_Number()
{
ArrayInitialize(Tickets,0);
int x=0;
for(int i_1=0;i_1<OrdersTotal();i_1++)
if(OrderSelect(i_1,SELECT_BY_POS))
if( OrderSymbol()=="USDJPY" &&
(OrderMagicNumber()==Magic_Number_N ||
OrderMagicNumber()==Magic_Number_A ||
OrderMagicNumber()==Magic_Number_R
)
)
{ Tickets[x]=OrderTicket();x++; }
return(x);
}

 

What problems are you having? What are you Expecting to Happen? What is it doing instead?


 
vx0532:

Code is as below: When Signal is 1, and Orders numbers traded by this EA is 0, then send OP_BUY order; this is very simple logic.

now I have attached this EA to demo account and living account, what is surprising is that:

at the same time, this EA only trades one order on demo account and trades many orders on living account, what is the matter?

some people tell me that this is because my living account is related to another account; when my account trade an order, in the fact, my account does nothing, but the related account trades really; does it?

thanks!

You send your order with

OrderSend(Symbol(),OP_BUY,Lots,Ask,Slip*Pips_Slip,Stop_Loss,TP,0,Magic_Number,0,0); //OrderMagicNumber()==Magic_Number

Yet when you check the total number of open order you do.

if( OrderSymbol()=="USDJPY" &&
(OrderMagicNumber()==Magic_Number_N || ........ why _N?
OrderMagicNumber()==Magic_Number_A || ........ why _A?
OrderMagicNumber()==Magic_Number_R ....... why _R?

Why aren't you checking for plain old Magic_Number?

 
ubzen:

You send your order with

OrderSend(Symbol(),OP_BUY,Lots,Ask,Slip*Pips_Slip,Stop_Loss,TP,0,Magic_Number,0,0); //OrderMagicNumber()==Magic_Number I have assign constant- Magic_Number_N to variable-Magic_Number.

Yet when you check the total number of open order you do.

if( OrderSymbol()=="USDJPY" &&
(OrderMagicNumber()==Magic_Number_N || ........ why _N?
OrderMagicNumber()==Magic_Number_A || ........ why _A? Others trades
OrderMagicNumber()==Magic_Number_R ....... why _R? Others trades

Why aren't you checking for plain old Magic_Number? I just want to count how many orders traded by this EA

Thank you for your reply and your questions

 
Are you trading the symbol "USDJPY" on your demo account, but a different symbol on your live account?
 
GumRai:
Are you trading the symbol "USDJPY" on your demo account, but a different symbol on your live account?

Yes, they are. Both "USDJPY", exactly.