insted of
if(Close[0]>10) {Faktor=1000; Digt=3;} else
if(Close[0]<10) {Faktor=100000; Digt=5;}
You could do sth like this:
if ( (OrderType()==OP_BUY || OrderType()==OP_SELL) && (OrderStopLoss()==0 || OrderTakeProfit()==0) && OrderSymbol()==Symbol() )
{
if( OrderTakeProfit()==0 && TakeProfitPips !=0 )
{
TPp = 0;
if(OrderType()==OP_BUY )
TPp = OrderOpenPrice()+TakeProfitPips*Point;
else if(OrderType()==OP_SELL)
TPp = OrderOpenPrice()-TakeProfitPips*Point;
TPp = NormalizeDouble(TPp, Digits);
}
if(OrderStopLoss()==0 && StopLossPips !=0)
{
SLp = 0;
if(OrderType()==OP_BUY)
SLp = OrderOpenPrice()-StopLossPips*Point;
else if(OrderType()==OP_SELL)
SLp = OrderOpenPrice()+StopLossPips*Point;
SLp = NormalizeDouble(SLp, Digits);
}
OrderModify(OrderTicket(),OrderOpenPrice(),SLp,TPp,0);
}