Reply

Is this a bug in the Money Management code?

3 replies

mikeyc

Customer, bbp_participant, community, 878 replies.

Visit profile

6 years ago #113966

Hi Mark and Team,

 

I’m looking at the MQ4 produced by SQ and can see this in the computeMMFromRiskPerTrade function:

   double lotMM1 = NormalizeDouble(riskPerTrade / CurrencyAdjuster / (slSize * 10.0), LotsDecimals);
   double lotMM;
   double lotStep = MarketInfo(Symbol(), MODE_LOTSTEP);
   if(MathMod(lotMM*100, lotStep*100) > 0) {
      lotMM = lotMM1 - MathMod(lotMM1, lotStep);
   } else {
      lotMM = lotMM1;
   }

Looks to me that the function is using lotMM in the if statement which is uninitialized at that point?  Should it be lotMM1 in the conditional?

 

Regards,

 

Mike

0

tomas262

Administrator, sq-ultimate, 679 replies.

Visit profile

6 years ago #131469

Will check that with Mark to be sure

0

geektrader

Customer, bbp_participant, community, 542 replies.

Visit profile

6 years ago #131474

Good find, indeed this doesn´t make much sense since the variable is 0 anytime that MathMod condition check is being performed.

0

Mark Fric

Administrator, sq-ultimate, 3 replies.

Visit profile

5 years ago #132118

I just want to let you know that we just released an autoupdate that fixes this. Your SQ should be updated next time you start it.

Mark
StrategyQuant architect

0

Viewing 4 posts - 1 through 4 (of 4 total)