我怎样才能尝试每 X 分钟下一次挂单直到成功?

How can I try to place a pending order every X minutes till it's successfull?

根据我所做的研究,止损位似乎阻止我下达挂单。我想通过每 X 分钟检查一次挂单是否会通过直到成功放置来解决这个问题。我怎样才能做到这一点?我通过以下方式下达挂单:

double myEntryPrice=NormalizeDouble(Bid+(stopLevel*Point)+(bottom - 3*Point),Digits);
   int ticketSell = OrderSend(Symbol(),OP_SELLLIMIT,lotSize, myEntryPrice,0, stopLoss,dTakeProfit,"SellOrder",magicnumber,0,Red);

#include <Arrays\ArrayObj.mqh>
class CPendingOrder : public CObject
   {
public:
    int m_cmd;
    double m_lot;
    double m_osl;
    double m_otp;

    CPendingOrder(const int cmd,const double lot,const double osl,const double otp):
         m_cmd(cmd),m_lot(lot),m_osl(osl),m_otp(otp){}
   ~CPendingOrder(){}
   };

CArrayObj *listOfPendingOrders;
datetime lastPendingAttempt=0;

int OnInit()
   {
    lastPendingAttempt=TimeCurrent();
    listOfPendingOrders=new CArrayObj();
    //---
    return (INIT_SUCCEDED);
   }
void OnDeinit(const int reason){delete(listOfPendingOrders);}
void OnTick()
   {
    checkPendingList();
    //other operations

    //adding a limit order to the list when you need to do that
    int cmd=OP_SELLLIMIT; 
    double lot=0.1, osl=0, otp=0;
    CPendingOrder *newOrder=new CPendingOrder(cmd,lot,osl,otp);
    listOfPendingOrders.Add(newOrder);
   }
void checkPendingList()
   {
    if(iTime(_Symbol,PERIOD_M1,0)<=lastPendingAttempt)return;
    lastPendingAttempt=iTime(_Symbol,PERIOD_M1,0);
    double myEntryPrice=Bid;//set your formulae if needed here
    for(int i=listOfPendingOrders.Total()-1;i>=0;i--)
      {
       CPendingOrder *order=listOfPendingOrders.At(i);
       int ticket=OrderSend(_Symbol,order.m_cmd,order.m_lot,myEntryPrice,0,order.m_osl,order.m_otp,NULL,magicNumber,0);
       if(ticket>0)
            listOfPendingOrders.Delete(i);
      }
   }