my expert It works differently in 2 accounts, please help, its important - page 2

 
Nor Azman Bin Ramli:
I think you do not track your total orders with a magic number. You should code a program that can trade separately with 2 different magic numbers if you use different charts to run robots simultaneously

i use this EA for 2 accounts, not 2 charts,
and sometimes one of the accounts not trade,

if i change magic number in acc 1 and acc 2, Could the problem be solved??

 
hamid khateri:

1_ there are no error in log when trade not maked! when Bid-Open>=Up is true  sometimes both acc make trade, sometimes 1 acc maked trade but another not, and in acc 2 there is not a error, (same VPS, same EA, same broker in both account!)

Print any error to the log if the OrderSend fails. I have already told you that.

enter help me that i sure order is send 1 time, not more,
when is a newBar i make enter false and reEnter true, after that 400PIP is ok and orderSended enter is true, and EA cant send a order again, untill a newBar created and make enter false, can i use another way to make sure that a order send just for once?

I am a great believer in using descriptive variable names.

I don't see why you need 2 boolean variables. I would just use 1 and call it TradePlacedThisBar. Set it to false on a new bar and true when a trade is opened.

when i must use RefreshRate? everytick?

You should use it if you think that the execution may take a long time or you have used Sleep() and the Ask/Bid may not be current.

Instead you could use

      double ask_current=SymbolInfoDouble(_Symbol,SYMBOL_ASK);
      double bid_current=SymbolInfoDouble(_Symbol,SYMBOL_BID);
 
Keith Watford:

1_ there are no error in log when trade not maked! when Bid-Open>=Up is true  sometimes both acc make trade, sometimes 1 acc maked trade but another not, and in acc 2 there is not a error, (same VPS, same EA, same broker in both account!)

Print any error to the log if the OrderSend fails. I have already told you that.

enter help me that i sure order is send 1 time, not more,
when is a newBar i make enter false and reEnter true, after that 400PIP is ok and orderSended enter is true, and EA cant send a order again, untill a newBar created and make enter false, can i use another way to make sure that a order send just for once?

I am a great believer in using descriptive variable names.

I don't see why you need 2 boolean variables. I would just use 1 and call it TradePlacedThisBar. Set it to false on a new bar and true when a trade is opened.

when i must use RefreshRate? everytick?

You should use it if you think that the execution may take a long time or you have used Sleep() and the Ask/Bid may not be current.

Instead you could use


bro i use int Start() to my codes,
if i use void OnTick() can be resolved?

 
hamid khateri:

if i use void OnTick() can be resolved?

No, but anyway, you should be using OnTick(), OnCalculate() by now, MQL4 update that brought these in was 6 years ago.