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

 

hi
i have maked a EA, it work good,
but in 2 account works differently,
i loaded it in 2 account, this accounts are in 1 server,

sometimes account 1 make trade, but account 2 not make trade!
EA is the same in 2 account,

the trade codes:

            if(dealNum==1 && !enter && ReEnter)
              {
               if(Bid-Open[0]>=Up)
                 {
                  ticketNumb = OrderSend(Symbol(),OP_BUY,0.94,Ask,0,SlB,TpB,"TEST",1374,0,clrBlueViolet);

                  Alert("UP", Ask);
                  
                  enter=true;
                  
                 }
              }

Up = double Up = 400*Point;

SlB =    double SlB = Ask-((170)*Point);

TpB =    double TpB = Ask+(2700*Point);

i say when BID - open >= 400pip make trade that moment,

but not work good, for EX: in acc 1 maked trade, but in acc 2 not traded!!


the codes is not broken, i tested this ea in the Strategy tester, it works good, but in real it have this problems,

and a another problem is:  when ea make trade, the Stoploss and Takeprofit is different,
i say the SL must be: 170pip, but in trade i see the stoploss is 160 or 180 or 190 or 150 or ....
and the TP have this problem too,

 
Topics concerning MT4 and MQL4 have their own section.
In future please post in the correct section.
I will move your topic to the MQL4 and Metatrader 4 section.
 
Keith Watford:
Topics concerning MT4 and MQL4 have their own section.
In future please post in the correct section.
I will move your topic to the MQL4 and Metatrader 4 section.

thank u,
why nobody not answer to my problem?
how can i fix it?

 
hamid khateri:

thank u,
why nobody not answer to my problem?
how can i fix it?

How should we know it without information?

 
Start from scratch and see where it goes wrong.
 
amando:

How should we know it without information?

what information you need?
i can give you everything that you need 

 
mt4ski:
Start from scratch and see where it goes wrong.

i checked EA for several times
its not broken

 
hamid khateri:

i checked EA for several times
its not broken

99.9%+ of the time the code IS broken.

Always use 

#property strict
if(dealNum==1 && !enter && ReEnter)
              {
               if(Bid-Open[0]>=Up)
                 {
                  ticketNumb = OrderSend(Symbol(),OP_BUY,0.94,Ask,0,SlB,TpB,"TEST",1374,0,clrBlueViolet);
                  Alert("UP", Ask);                  
                  enter=true;                  
                 }
              }

Always print the error to the log if the OrderSend() fails so that you know why.

Where are dealNum and ReEnter assigned values?

Where is enter reset to false once a trade has been placed?

Use RefreshRates if necessary to make sure that the Ask is current.

Give values to SlB and TpB in the same block of code as the OrderSend()


I have deleted your new topic which is almost the same as this one.

 
hamid khateri:

i checked EA for several times
its not broken

You came here for help because something is wrong. I'm trying to help you investigate.

 
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
 
Keith Watford:

99.9%+ of the time the code IS broken.

Always use 

Always print the error to the log if the OrderSend() fails so that you know why.

Where are dealNum and ReEnter assigned values?

Where is enter reset to false once a trade has been placed?

Use RefreshRates if necessary to make sure that the Ask is current.

Give values to SlB and TpB in the same block of code as the OrderSend()


I have deleted your new topic which is almost the same as this one.

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!)

2_ dealNum is a number, that if previous trade is hit TP, dealNum is (dealNum+1), if previous trade hit sl dealNum is (dealNum+1),
and i have 32 codes like abow codes that have ordersend, with different dealNumb and different valume for dealNum,
and dealNum choose which OrderSend must be send,
like:

 if(dealNum==1 && !enter && ReEnter)
              {
               if(Bid-Open[0]>=Up)
                 {
                  ticketNumb = OrderSend(Symbol(),OP_BUY,0.94,Ask,0,SlB,TpB,"TEST",1374,0,clrBlueViolet);
                  Alert("UP", Ask)
                  enter=true;
                   }
                 }

 if(dealNum==2 && !enter && ReEnter)
              {
               if(Bid-Open[0]>=Up)
                 {
                  ticketNumb = OrderSend(Symbol(),OP_BUY,1.45,Ask,0,SlB,TpB,"TEST",1374,0,clrBlueViolet);
                  Alert("UP", Ask)
                  enter=true;
                   }
                 }

 if(dealNum==3 && !enter && ReEnter)
              {
               if(Bid-Open[0]>=Up)
                 {
                  ticketNumb = OrderSend(Symbol(),OP_BUY,3.67,Ask,0,SlB,TpB,"TEST",1374,0,clrBlueViolet);
                  Alert("UP", Ask)
                  enter=true;
                   }
                 }

.........

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,

when i must use RefreshRate? everytick?


and a another question,
can i use another way to make sure that a order send just for once?

Reason: