Hello,

it seems there is incorrect logic with my last reply. The function calculated lot dimensions not from Lots factor, but from :
lot=NormalizeDouble(AccountFreeMarg in()*MaximumRisk/1000.0,1);

firstly, about NormalizeDouble(. . ,1), it is going to yield worth with 1 digit accuracy.

For example, var1 = 5/8 = 0.625.
NormalizeDouble(var1,2) = 0.63 gt;gt;gt; 2 digit after decimal point
NormalizeDouble(var1,1) = 0.6 gt;gt;gt; 1 digit after decimal point



form your case,
AccountFreeMargin=3000
MaximumRisk = 0.01
AccountFreeMargin*MaximumRisk/1000 = 3000*0.01/1000 = 0.03
lot=NormalizeDouble(0.03,1) = 0.0 !!! The 3 is omitted because it is in the second place, counted from the left following decimal point

afterward before returning the result:
//-- yield lot dimensions
if(lotlt;0.01) lot=0.01;
return(lot);
therefore, because the calculated lot above result 0 that is smaller then 0.01, the role returned 0.01;

last thing, you need to use if(DecreaseFactorgt;0) instead if(DecreaseFactorlt;0), and make sure that the worth of DecreaseFactor is a positive value (for example 3)

hope this help