How to fix this?

 

I just write a simple EA with the principle is :

1. if example there is openB10, make B11 and S9

2. if example there is openB10, and there is open B11, make S9

3. if example there is openB10, and there is open S9, make B11

4. so the point is if move up make BUY and if move down make SELL, but the SL is 10x TP, the open order is have to wait for its SL if it move to wrong direction.

But all is going wrong and i don't know to fix it, sorry i am an amateur.

Please help, Thank you

Files:
 
kieruwin wrote >>

I just write a simple EA with the principle is :

1. if example there is openB10, make B11 and S9

2. if example there is openB10, and there is open B11, make S9

3. if example there is openB10, and there is open S9, make B11

4. so the point is if move up make BUY and if move down make SELL, but the SL is 10x TP, the open order is have to wait for its SL if it move to wrong direction.

But all is going wrong and i don't know to fix it, sorry i am an amateur.

Please help, Thank you

Basicly i edit the code from this "S-1"EA. It fill up BUY and SELL on every point. So i like to change it to my definition above, if move up make BUY and if move down make Sell.

Files:
sr1lbase.mq4  75 kb
Reason: