Download MetaTrader 5

coding expert advisor

To add comments, please log in or register
Articles have already helped many traders. Come and read them!
trevon.balfour
13
trevon.balfour 2015.07.31 09:29 

could someone please help me in coding this:

 double lotsoptimized(){

double lot;
if(stoploss>0)lot=AccountBalance()*(risk/100)/(stoploss*pt/MarketInfo(Symbol(),MODE_TICKSIZE) 
*MarketInfo(Symbol(),MODE_TICKVALUE));
else lot=NormalizeDouble((AccountBalance()/lotsize) 
*minlot*risk,lotdigits);
return(lot);

 

into the file for risk management so that

 2% Per Trade Risk Formula

Account size x 2% = Risk Amount
$10,000 X 2% = $200

 If you had a $10,000 account balance and 200 pip stop and selected 2% risk per trade, you would be able to trade only 0.1 lots because 0.1 lots stopped out at the 200 pips stop loss would be $200 or 2%

Files:
EA1.mq4 23 kb
JD4
1101
JD4 2015.07.31 20:23  
When posting code sections, please use the SRC button (located at the top of the comment entry area next to the camera icon).
To add comments, please log in or register