can anyone help me? I create a script which Automatic order, but when I use it, why it create two orders?

 
#property copyright "Copyright 2022, MetaQuotes Ltd."
#property link      "https://www.mql5.com"
#property version   "1.00"
void OnStart()
  {
//---
  MqlTradeResult result={}; 
  MqlTradeRequest request={}; 
  request.action=TRADE_ACTION_DEAL;
  request.symbol=Symbol();
  request.type=ORDER_TYPE_BUY;
  request.volume=0.1;
  request.deviation=100;
  request.price=SymbolInfoDouble(Symbol(),SYMBOL_ASK);
  request.sl=SymbolInfoDouble(Symbol(),SYMBOL_ASK)-200*Point();
  request.tp=SymbolInfoDouble(Symbol(),SYMBOL_ASK)+200*Point();
  request.type_filling=ORDER_FILLING_IOC;
  request.comment="com";
  request.magic=223;
  OrderSend(request,result);
  if(!OrderSend(request,result))
  PrintFormat("OrderSend error %d",GetLastError());     
  PrintFormat("retcode=%u  deal=%I64u  order=%I64u",result.retcode,result.deal,result.order);
  }



why create two orders,I only need one order.


 
byreed: why create two orders,I only need one order.

Because you have called "OrderSend" twice:

OrderSend(request,result);
if(!OrderSend(request,result))
Reason: