continue.. 1) Money Management - Defining Lotsize and TP and SL
Q : So, is the rule of LotSize = Equity/(Equityx10) is Correct for you to risk 2% of your account ?
A : Yes, if you have Trading Strategy that is SO GOOD that the rate of hitting SL is less than hitting TP that is set much higher than SL.
BUT, by experience - it is NOT - the answer is NO.
Q : So, again, what is the Rule of Opening the LotSize in order to ONLY risk 2% of my account ?
A : It always depend on the Trading Strategies. There are several KNOWN trading stragies out there - SCALP, Long Term, Directional, Hedging, Pyramiding, Correlation, Martingle, GRID, etc. Each strategy requires different LotSize management. Money Management is Simple = how much Risk you want to set, every time trade is open. LotSize Management is quite complex and it is a subset of Money Management.
So, with 1000usd, if we have a trading strategy that is Directional, based on Indicator, and our SL is normally set at -40 pips, we need to use 0.05 Lot Standard every time we open a trade.
Q : But, somehow, my Broker, eg FxOpen, do not allow me to Trade with 0.05 Lot, the minimum is 0.1 Lot, so what should I do ?
A : The obvious answer is to raise your equity / trading capital, but right now, almost all Brokers have either Mini or Micro account, so u need to open either Mini or Micro account.
For example, say in IBFX - with 1000usd, mini account (also called 10K account), if your strategy says -40 pip SL, you want that 1 pip = 0.5usd. 1 Mini Lot = 1usd, meaning to say, we need to open 0.5 Mini Lot in order to risk 2%.
However, there are variations among Forex Brokers, with regards to Minimum Lot to Open, Maximum Lot to Open, Highest Leverage, Margin requirement, Lot Step Size, which can be determined by UNDERSTANDING the MarketInfo() function :
In this LotSize Management Case, The most important parameters are :
MODE_LOTSIZE ==> LotSize in base currency , 100000 = standard account, 10000 = mini account
MODE_MINLOT ==> minimum permitted amount of a lot
MODE_LOTSTEP ==> steps for changing lot
MODE_MAXLOT ==> maximum permitted amount of a lot
MODE_MARGINREQUIRED ==> free margin required to open one lot
MODE_TICKVALUE ==> Tick Value in Deposit Currency
(detail here :
http://docs.mql4.com/constants/marketinfo)
We need to understand this function as well : AccountFreeMargin()
LotSizes for other strategies :
For Grid strategy, how many grid you want to open, if say your max grid to open is 10, then split the lotsize to another 10, ie, with 1000usd, mini account, IBFX for example, our EA should open 0.05 mini Lot per grid line(if we satisfy the broker's MODE_MINLOT)
For Martingale Strategy, the First Open Lot, is way much smaller, and it depends on what's the maximum layer the martingle need to open the positions. I would start my Martingale EA with 0.005 mini Lot or 0.5 micro lot as a start. (My Special Martingale EA does not use this Rule, just fyi)
Q : So, what then, the Best Formula of LotSizeCalculation, regardless of What Equity do I start and What Leverage do I select, in order for me to Trade with my EA ?
This is quite TRICKY, but you have to understand : - If you want to risk 2% then you have to fix one of the variables: the stop loss level or the LotSize
If we want to fix the SL, then the LotSize is varied, and if we want to fix the LotSize, the SL is varied.
The better way is always to find a way so that the LotSize can be incremented, based on the Equity that we have.
//Define Variables
double LotSize;
extern double Risk_Percent = 2.0;
extern double TP_Percent = 4.0;
extern double StopLoss = 40;
extern double LotFactor = 1.0; //1 = Directional, 0.1 = Grid, 0.01 = Martingale
void LotSizeCalculation()
{
if(MarketInfo(Pair,MODE_MINLOT) == 0.1) int LotSizeDigit = 1;
else if(MarketInfo(Pair,MODE_MINLOT) == 0.01) LotSizeDigit = 2;
double MinLots = NormalizeDouble(MarketInfo(Pair,MODE_MINLOT),LotSizeDigit);
double MaxLots = NormalizeDouble(MarketInfo(Pair,MODE_MAXLOT),LotSizeDigit);
double AccountFM = NormalizeDouble(AccountFreeMargin(),2);
if (MarketInfo(Pair, MODE_LOTSIZE) == 100000) LotSize = (AccountFM*(Risk_Percent/100) * LotFactor) / (StopLoss * MarketInfo(Pair, MODE_TICKVALUE));
else if (MarketInfo(Pair, MODE_LOTSIZE) == 10000) LotSize = (AccountFM*(Risk_Percent/100) * LotFactor)/ (StopLoss * MarketInfo(Pair, MODE_TICKVALUE));
else if (MarketInfo(Pair, MODE_LOTSIZE) == 1000) LotSize = (AccountFM*(Risk_Percent/100) * LotFactor)/ (StopLoss * MarketInfo(Pair, MODE_TICKVALUE));
LotSize = NormalizeDouble(LotSize,LotSizeDigit);
if(LotSize > MaxLots) LotSize = MaxLots;
if(LotSize < MinLots)
{
LotSize = MinLots;
Alert("Your Equity is Below Tradeable Lots, EA changed to Min Lot possible."); //Message Box will pop up
Print("Your Equity is Below Tradeable Lots, EA changed to Min Lot possible."); //This message will appear in Expert tab
}
}
Q : Is there any way that I can do in the Program so that I dont have to key in the 'm' for mini or '_" for the Symbol and let the Program automatically figure it out ?
A : Add this function -
void AdjustSymbolForMiniMicro()
{
if (StringLen(Symbol()) == 7)
{
Pair = Pair + StringSubstr(Symbol(), 6, 1);
}
}
Q : Why don't u include the Margin Requirement and Leverage calculation into the LotSize Calculation ?
A : Although there are other people who include the Margin Requirement into the calculation of the LotSize, however, in my opinion, and in this context of defining that 2% Risk - we have achieved the target.
However, the Margin Requirement and the Leverage selection, is very important, if our strategy involves Grid, Pyramiding or Martingale, simply because, we need a lot of margin in order to open more trades.
This is where the money management topic is really an issue - you have to find out, how to risk only 2% of your equity when ALL the positions hit the stop loss and not only a single position.
I will leave this to your own judgment once you have more experience in this.