# How to fix Tp & Sl

hi,

i am new to mql4  i am trying to build a EA  i the problem is  close position function is not working i tried everything  can anyione help me .  i tried to add it with ordersend function   i used this expreation Bid + Tp * _Point  but it gave me problem that it closes order way befor or sometine way early. i gave tp = 600 and sl = 400 still did same then i changed it to 60,40 then it stoped opening trades.

now this is also not working properly

```for(int i=0; i<order; i++) {

if(OrderSelect(i,SELECT_BY_POS)) {

if(OrderSymbol() == _Symbol && OrderMagicNumber() == 3310 ) {

double Stop = NormalizeDouble(Bid - Sl * _Point, Digits);

double TP = NormalizeDouble(Bid + Tp * _Point, Digits);

if(OrderProfit() >= Stop || OrderProfit() >= TP) {

bool confirm = OrderClose(OrderTicket(), OrderLots(), Bid, 3, CLR_NONE);

if(confirm == true) {

}

}

} else if(OrderSymbol() == _Symbol && OrderMagicNumber() == 1011 ) {

double SStop = NormalizeDouble(Ask + Sl * _Point, Digits);

double TProfit = NormalizeDouble(Ask - Tp * _Point, Digits);

if(OrderProfit() >= SStop || OrderProfit() >= TProfit) {

bool confirmSell = OrderClose(OrderTicket(), OrderLots(), Ask, 3, CLR_NONE);

if(confirmSell == true) {

}

}

}

}

}

```

Hasnain Raza:
```           double TP = NormalizeDouble(Bid + Tp * _Point, Digits);

if(OrderProfit() >= Stop || OrderProfit() >= TP) {```

TP and Stop are prices (1.01234). OrderProfit is currency (\$123.45). Comparison is nonsense.

Reason: