decrease factor's algorithm

 

dear gurus:I am an newbie in MQL4,just find an method of cut positions when lossing, the code as follows:
extern double DecreaseFactor = 10;
if(DecreaseFactor>0)
{
for(int i=orders-1;i>=0;i--)
{
if(OrderSelect(i,SELECT_BY_POS,MODE_HISTORY)==false) { Print("Error in history!"); break; }
if(OrderSymbol()!=Symbol() || OrderType()>OP_SELL) continue;
//----
if(OrderProfit()>0) break;
if(OrderProfit()<0) losses++;
}
if(losses>1) lot=NormalizeDouble(lot-lot*losses/DecreaseFactor,1);

however I use it

to backtrack,the results disorient me.
the follow are some trade log:
type order no size price profit balance
buy 1 2.00 1.3345 0.00 50000.00
close 1 2.00 1.3272 -1555.74 48444.26
sell 2 1.90 1.3297 0.00 48444.26
close 2 1.90 1.3361 -1292.00 47152.26
buy 3 1.50 1.3354 0.00 47152.26
close 3 1.50 1.3315 -656.81 46495.45
sell 4 1.30 1.3306 0.00 46495.45
close 4 1.30 1.2956 4436.60 50932.05


the question is :
2 is the default size in my EA,but what the "lot" stands for in the equation 2 or the latest size?
why the order 4's size becomes 1.30?
PLS guru show the arithmetic process TKS!

 

add another problem here:

I wanna count the market basic info. For example:fluctation in each timeframe,but I don't know how to code this.

I wold appreciating who shows them here.

Reason: