Pending Orders

Profit factor:
0.00
Orders Execution
It automatically opens orders when conditions are reachedChecks for the total of open orders
0 Views
0 Downloads
0 Favorites
Pending Orders
/*-----------------------------+
|			       |
| Shared by www.Aptrafx.com    |
|			       |
+------------------------------*/


void init()
{
   // Create some Orders 
   
   double iBuyPrice = 0;
   double iSellPrice = 0;
   
   iBuyPrice = Ask;
   iSellPrice =  Bid;
   
   iBuyPrice = iBuyPrice - 0.0020;
   iSellPrice = iSellPrice + 0.0020;

   OrderSend(Symbol(), OP_BUYLIMIT, 1, iBuyPrice, 4, 0, 0, "", 123456789, 0 ,Blue);
   OrderSend(Symbol(), OP_BUYLIMIT, 1, iBuyPrice, 4, 0, 0, "", 123456789, 0 ,Blue);
   
   OrderSend(Symbol(), OP_SELLLIMIT, 1, iSellPrice, 4, 0, 0, "", 123456789, 0 ,Blue);
   OrderSend(Symbol(), OP_SELLLIMIT, 1, iSellPrice, 4, 0, 0, "", 123456789, 0 ,Blue);

   Print("Total Pending Orders (init): ", GetTotalPendingOrders());   
}

void start()
{
   // start what?
   
   Print("Total Pending Orders (start): ", GetTotalPendingOrders());
}

int GetTotalPendingOrders()
{
   int iCounter = 0;
   int iSelectedOrderType = 0;
   int iPendingOrders = 0;
   
   for(iCounter = 0; iCounter < OrdersTotal(); iCounter++)
   {      
      if ( OrderSelect(iCounter, SELECT_BY_POS, MODE_TRADES) == true )
      {
         iSelectedOrderType = OrderType();
         
         if ( iSelectedOrderType == OP_BUYLIMIT || iSelectedOrderType == OP_BUYSTOP || iSelectedOrderType == OP_SELLLIMIT || iSelectedOrderType == OP_SELLSTOP )
         {
            iPendingOrders = iPendingOrders + 1;
         }
      }
      else
      {
         Print("Unable to select order: ", iCounter);
      }
      
   }
   
   return (iPendingOrders);
}









Profitability Reports

NZD/USD Oct 2024 - Jan 2025
0.00
Total Trades 2
Won Trades 0
Lost trades 2
Win Rate 0.00 %
Expected payoff -4826.00
Gross Profit 0.00
Gross Loss -9652.00
Total Net Profit -9652.00
-100%
-50%
0%
50%
100%
GBP/USD Oct 2024 - Jan 2025
0.00
Total Trades 2
Won Trades 0
Lost trades 2
Win Rate 0.00 %
Expected payoff -4626.00
Gross Profit 0.00
Gross Loss -9252.00
Total Net Profit -9252.00
-100%
-50%
0%
50%
100%
AUD/USD Oct 2024 - Jan 2025
0.00
Total Trades 2
Won Trades 0
Lost trades 0
Win Rate 0.00 %
Expected payoff -4826.00
Gross Profit 0.00
Gross Loss -9652.00
Total Net Profit -9652.00
-100%
-50%
0%
50%
100%

Comments