please help ! simple risk management

 
extern double RiskMM=0.02;

...... 

int init()

{ 



...... 

double InitialBalance=AccountBalance();


} 



int start()

{

double CurrentRisk = InitialBalance- AccountEquity();

          CurrentRisk=CurrentRisk/InitialBalance;

         if(CurrentRisk>=Risk) {.....CloseAll(); return(-1); } 



......

......

return(0); 

} 





 

for example,the initial balance = 10,000

the risk money = 10,000* 0.02 = 200, this means the max loss money is 200.

but the loss money is up to 500. this Risk management does not work.

why?

 

sorry. I made a mistake.

the risk management works.

 

except what you have is bogus.

Max Risk is open price-initial stop loss. Max Risk To Account = Max Risk * lot size * price per point. You set a stop loss of 100 pips and open 0.02 lots, your risking $20 plus spread. Look at a real money management

Also every time you refresh the chart or change periods or pairs, etc. you go through an deinit/init cycle and InitialBalance gets changed.

Reason: