Scripts: ytg_Percent_Lot

 

ytg_Percent_Lot:

The script calculates the number of lots to trade using the specified percentage of risk funds.

Author: Yuriy Tokman

ytg_Percent_Lot

 

Hi, Yuri

My philosophy is a little different, RISK = MAXIMUM LOSS.

 

First of all, I think that the calculation must take into account your stoploss level.

Consider two trades placed by two traders at the same time:

Trader A:  Buy 1.00 Lot, STP @20 Pips.

Trader B:  Buy 1.00 Lot, STP @40 Pips.

Trader B has twice as much risk, so for the same risk as Trader A, he must trade 0.5 LotSize.

 

Leverage must also be taken into account, if for example it is at 100.00, then profits and losses are at x100 level. The 'At Risk' is in money, it must be translated into Lots. Leverage MUST be accounted for.

If $2,000 at risk is sensible, then if leverafe is 100, the LotSize must also be divided by 100.00.

 

I also do not think it is good practice to use 'free margin' as a basis for the calculation. If you are at maximium exposure, and a trade moves against you, your margin is negative. Bad Thing!

 

//FreeMoney=AccountInfoDouble(ACCOUNT_FREEMARGIN);  // NOT SAFE!!

FreeMoney=AccountInfoDouble(ACCOUNT_BALANCE);       // SAFE

 

LotSize = (FreeMoney*AtRisk%) / AccountInfoInteger(ACCOUNT_LEVERAGE) / STP) 

USD 9997, At Risk 33.33%, STP 20, Leverage 100 gives a Lot Size of 1.60

 

Hope this makes sense?

T.