MM doesn't work in Multicharts

risk fixed %  balance


// =================================================================
// MONEY MANAGEMENT LOGIC
// =================================================================
Method double RiskFixedPctBalance(double OpenPrice, double SL) //unexpected 'double'
vars:
    double MoneyToRisk,  //  double MoneyToRisk(0),
  double OneLotSLInMoney,
  double TradeSize;
begin
  MoneyToRisk = (InitialCapital + NetProfit) * mmRiskPercent / 100;
  OneLotSLInMoney = Absvalue(OpenPrice - SL) * PointValue;
  TradeSize = IntPortion(MoneyToRisk / OneLotSLInMoney * Power(10, mmDecimals)) / Power(10, mmDecimals); //Round down to mmDecimals
 
  If TradeSize <= 0 then return mmLotsIfNoMM;   //syntax error, unexpected 'identificator'


  If TradeSize > mmMaxLots then return mmMaxLots;
 
  Return TradeSize;
end;


And same BUG with Risk fixed % of account, Fixed amount





Attachments
No attachments
  • Votes +1
  • Project StrategyQuant X
  • Type Bug
  • Status Refused
  • Priority Normal

History

e
#1

eastpeace

02.02.2019 09:51

Task created

b
#2

beppil

03.05.2019 11:00
Voted for this task.
MF
#3

Mark Fric

13.06.2019 13:23

Status changed from New to Waiting for information

please attach the exact strategy that is not workign for you. The code you copied is not valid, maybe old version?

the most update code for this function is:

------------------------------

SQ_RiskFixedPctBalance 

------------------------------

inputs:

OpenPrice( numericsimple ), 

SL( numericsimple ),

RiskPercent( numericsimple ),

Decimals( numericsimple ),

LotsIfNoMM( numericsimple ),

MaxLots( numericsimple ),

InitialCapital( numericsimple );

vars:

  double MoneyToRisk( 0 ),

  double OneLotSLInMoney( 0 ),

  double TradeSize( 0 );


MoneyToRisk = (InitialCapital + NetProfit) * RiskPercent / 100;

OneLotSLInMoney = Absvalue(OpenPrice - SL) * PointValue;


If OneLotSLInMoney > 0 then

TradeSize = IntPortion(MoneyToRisk / OneLotSLInMoney * Power(10, Decimals)) / Power(10, Decimals) //Round down to Decimals

Else 

TradeSize = 0;

 

If TradeSize <= 0 then TradeSize = LotsIfNoMM;

If TradeSize > MaxLots then TradeSize = MaxLots;

 

SQ_RiskFixedPctBalance = TradeSize;


MF
#4

Mark Fric

17.07.2019 13:28

Status changed from Waiting for information to Refused


Votes: +1

Drop files to upload

or

choose files

Max size: 5MB

Not allowed: exe, msi, application, reg, php, js, htaccess, htpasswd, gitignore

...
Wait please