What does this chunk of code mean? Is this the D'Alembert thingy?
/ ------------------------------------------------------------------------------------------------
// SORT BY LOTS
// ------------------------------------------------------------------------------------------------
void SortByLots()
{
int aux_tickets;
double aux_lots, aux_profit, aux_price;
// We are going to sort orders by volume
// m[0] smallest volume m[size-1] largest volume
// BUY ORDERS
for(int i=0; i<buys-1; i++)
{
for(int j=i+1; j<buys; j++)
{
if (buy_lots>0 && buy_lots[j]>0)
{
// at least 2 orders
if (buy_lots[j]<buy_lots)
{
// sorting
// ...lots...
aux_lots=buy_lots;
buy_lots=buy_lots[j];
buy_lots[j]=aux_lots;
// ...tickets...
aux_tickets=buy_tickets;
buy_tickets=buy_tickets[j];
buy_tickets[j]=aux_tickets;
// ...profits...
aux_profit=buy_profit;
buy_profit=buy_profit[j];
buy_profit[j]=aux_profit;
// ...and open price
aux_price=buy_price;
buy_price=buy_price[j];
buy_price[j]=aux_price;
}
}
}
}
// SELL ORDERS
for(i=0; i<sells-1; i++)
{
for(j=i+1; j<sells; j++)
{
if (sell_lots>0 && sell_lots[j]>0)
{
// at least 2 orders
if (sell_lots[j]<sell_lots)
{
// sorting...
// ...lots...
aux_lots=sell_lots;
sell_lots=sell_lots[j];
sell_lots[j]=aux_lots;
// ...tickets...
aux_tickets=sell_tickets;
sell_tickets=sell_tickets[j];
sell_tickets[j]=aux_tickets;
// ...profits...
aux_profit=sell_profit;
sell_profit=sell_profit[j];
sell_profit[j]=aux_profit;
// ...and open price
aux_price=sell_price;
sell_price=sell_price[j];
sell_price[j]=aux_price;
}
}
}
}
}
/ ------------------------------------------------------------------------------------------------
// SORT BY LOTS
// ------------------------------------------------------------------------------------------------
void SortByLots()
{
int aux_tickets;
double aux_lots, aux_profit, aux_price;
// We are going to sort orders by volume
// m[0] smallest volume m[size-1] largest volume
// BUY ORDERS
for(int i=0; i<buys-1; i++)
{
for(int j=i+1; j<buys; j++)
{
if (buy_lots>0 && buy_lots[j]>0)
{
// at least 2 orders
if (buy_lots[j]<buy_lots)
{
// sorting
// ...lots...
aux_lots=buy_lots;
buy_lots=buy_lots[j];
buy_lots[j]=aux_lots;
// ...tickets...
aux_tickets=buy_tickets;
buy_tickets=buy_tickets[j];
buy_tickets[j]=aux_tickets;
// ...profits...
aux_profit=buy_profit;
buy_profit=buy_profit[j];
buy_profit[j]=aux_profit;
// ...and open price
aux_price=buy_price;
buy_price=buy_price[j];
buy_price[j]=aux_price;
}
}
}
}
// SELL ORDERS
for(i=0; i<sells-1; i++)
{
for(j=i+1; j<sells; j++)
{
if (sell_lots>0 && sell_lots[j]>0)
{
// at least 2 orders
if (sell_lots[j]<sell_lots)
{
// sorting...
// ...lots...
aux_lots=sell_lots;
sell_lots=sell_lots[j];
sell_lots[j]=aux_lots;
// ...tickets...
aux_tickets=sell_tickets;
sell_tickets=sell_tickets[j];
sell_tickets[j]=aux_tickets;
// ...profits...
aux_profit=sell_profit;
sell_profit=sell_profit[j];
sell_profit[j]=aux_profit;
// ...and open price
aux_price=sell_price;
sell_price=sell_price[j];
sell_price[j]=aux_price;
}
}
}
}
}