vladradon
Программист
Все-таки допустил неточность:Большое спасибо! Сегодня попробую!
PHP:
void BuyPendingOrder43()
{
int ticket=0;
int stoplevel=(int)MarketInfo(_Symbol,MODE_STOPLEVEL);
double price = NormalizeDouble(Close[1]+PriceOffset1*PipValue*_Point,NDigits);
double SL=NormalizeDouble(price-StopLoss1*PipValue*_Point,NDigits);
if(StopLoss1==0) SL=0.0;
double TP=NormalizeDouble(price+Takeprofit1*PipValue*_Point,NDigits);
if(Takeprofit1==0) TP=0.0;
if(stoplevel>0)
{
if(SL>0.0 && ((int)(MathAbs(SL-Ask)/_Point)<=stoplevel ||
(int)(MathAbs(SL-Bid)/_Point)<=stoplevel ||
(int)(MathAbs(SL-price)/_Point)<=stoplevel)) {Print("Error StopLoss"); return;}
if(TP>0.0 && ((int)(MathAbs(TP-Ask)/_Point)<=stoplevel ||
(int)(MathAbs(TP-Bid)/_Point)<=stoplevel ||
(int)(MathAbs(TP-price)/_Point)<=stoplevel)) {Print("Error TakeProfit"); return;}
for(int cnt=0; cnt<OrdersTotal(); cnt++)
if(OrderSelect(cnt,SELECT_BY_POS,MODE_TRADES) && OrderSymbol()==_Symbol)
if((price>0.0 && ((int)(MathAbs(OrderOpenPrice()-price)/_Point)<=stoplevel ||
(int)(MathAbs(OrderTakeProfit()-price)/_Point)<=stoplevel ||
(int)(MathAbs(OrderStopLoss()-price)/_Point)<=stoplevel)) ||
(TP>0.0 && ((int)(MathAbs(OrderOpenPrice()-TP)/_Point)<=stoplevel ||
(int)(MathAbs(OrderTakeProfit()-TP)/_Point)<=stoplevel ||
(int)(MathAbs(OrderStopLoss()-TP)/_Point)<=stoplevel)) ||
(SL>0.0 && ((int)(MathAbs(OrderOpenPrice()-SL)/_Point)<=stoplevel ||
(int)(MathAbs(OrderTakeProfit()-SL)/_Point)<=stoplevel ||
(int)(MathAbs(OrderStopLoss()-SL)/_Point)<=stoplevel)))
{Print("Error cross other orders"); return;}
}
if(price>Ask+stoplevel*_Point) ticket=OrderSend(Symbol(),OP_BUYSTOP,Lots1,price,4,SL,TP,"My Expert",1,Blue);
if(ticket==-1) Print("OrderSend() error - ",ErrorDescription(GetLastError()));
}
PHP:
if(price<Bid-stoplevel*_Point) ticket=OrderSend(.....
Последнее редактирование: