Q : How to divide a number into several, unequal, yet increasing numbers [ for sending a PlaceOrder( OP_BUY, lots ) contract XTO ]?
A : The problem is not as free as it might look for a first sight :
In metatrader Terminal ecosystem, the problem formulation has also to obey the externally decided factors ( that are mandatory for any XTO with an ambition not to get rejected, as being principally incompatible with the XTO Terms & Conditions set, and to get filled ~ "placed" At Market )
These factors are reportable via a call to:
MarketInfo( <_a_SymbolToReportSTRING>, MODE_MINLOT  ); // a minimum permitted size
MarketInfo( <_a_SymbolToReportSTRING>, MODE_LOTSTEP ); // a mandatory size-stepping
MarketInfo( <_a_SymbolToReportSTRING>, MODE_MAXLOT  ); // a maximum permitted size
Additionally, any such lot-size has to be prior of submitting an XTO also "normalised" for given number of decimal places, so as to successfully placed / accepted by the Trading-Server on the Broker's side. A failure to do so results in remotely rejected XTO-s ( which obviously come at a remarkable blocking / immense code-execution latency penalty one would always want to prevent from ever happening in real trading )
Last, but not least, any such XTO sizing has to be covered by a safe amount of leveraged equity ( checking the free-margin availability first, before ever sending any such XTO for reasons just mentioned above ).
The code:
While the initial pseudo-code above, does a progressive ( Martingale-alike ) lot-size scaling:
>>> aListOfFACTORs = [ 100, 120, 130, 140, 140, 160, 170, 180, 190 ]
>>> for endPoint in range( len( aListOfFACTORs ) ):
...     product = 1.
...     for item in aListOfFACTORs[:1+endPoint]:
...         product *= item / 100.
...     print( "Lots{0:} ~ ought be about {1:} times the amount of Lots1".format( 1 + endPoint, product ) )
... 
Lots1 ~ ought be about  1.0        times the amount of Lots1
Lots2 ~ ought be about  1.2        times the amount of Lots1
Lots3 ~ ought be about  1.56       times the amount of Lots1
Lots4 ~ ought be about  2.184      times the amount of Lots1
Lots5 ~ ought be about  3.0576     times the amount of Lots1
Lots6 ~ ought be about  4.89216    times the amount of Lots1
Lots7 ~ ought be about  8.316672   times the amount of Lots1
Lots8 ~ ought be about 14.9700096  times the amount of Lots1
Lots9 ~ ought be about 28.44301824 times the amount of Lots1
the _MINLOT, _LOTSTEP and _MAXLOT put the game into a new light.
Any successful strategy is not free to chose the sizes. Given the said 9-steps and a fixed amount of the total-amount ~ 6.7 lots, the process can obey the stepping and total, plus, it must obey the MarketInfo()-reported sizing algebra
Given 9-steps are mandatory,
each one has to be at least _MINLOT-sized:
double total_amount_to_split = aSizeToSPLIT;
total_amount_to_split = Min(   aSizeToSPLIT,                 // a wished-to-have-sizing
                               FreeMargin/LotInBaseCurr*sFty // a FreeMargin-covered size 
                               );
int next = 0;
while ( total_amount_to_split >= _MINLOT )
{       total_amount_to_split -= _MINLOT;
        lot_size[next++]       = _MINLOT;
       }
/*
###################################################################################
------------------------------------------------- HERE, WE HAVE 0:next lot_sizes
                                                                  next NEED NOT == 9
If there is anything yet to split:
   there is an integer amount of _LOTSTEP-s to distribute among 'em
   HERE, and ONLY here, you have a freedom to decide about split/mapping
                                           of the integer amount of _LOTSTEP-sized
                                           additions to the _MINLOT "pre"-sets
                                                                     in lot_size[]-s
   YET, still no more than _MAXLOT is permissible for the above explained reasons
------------------------------------------------- CODE has to obey this, if XTO-s
                                                                         are to
                                                                         get a chance
###################################################################################
                                                  */