![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Mikki
My demo account is in recovery mode today as it is opening up more trades of EURUSD. However, I had set the RiskMargin Level at 40, and now it has used over 64% of margin... Seems like it is not checking the margin requirement before opening up more positions...
MaxUsedMargin 40
Account RiskPercent 0.2
MaxInitialLotSize 1.2
(Used Margin 68.4%, limit: 40%) <-- this is what the message says
On a 10K account, it is opening:
0.22, 0.22, 0.22, 0.22, 0.50, 0.74 = Total 6 trades.
Is this normal? the account has a 50:1 leverage, could this be the case for miscalculation? Or is it simply not checking the MaxUsedMargin? Because I think at the 5th trade, 0.50 lot, it has already gone over the limit. At one time the demo account margin percentage was down to 135%, which means I am seriously close to a Margin Call.
I've noticed the same.
Btw Mikki, what happened on 7 september on your account?
I've never noticed (yet) such a huge drawdown.
This code is supposedly adding more weight to the last period, but I think the code is reversed. Shouldn't it be the following instead?
[CODE]bRatioWeighted = (aRatio * 2 + bRatio) / 3[CODE]
i have a question???
hi to all traders and coders,,
i have a question, how works the !xmeter.mq4 indicator? how they compute the strength of each currency?
anyone can explain this please..
in a real account what is the least this really good the best I have ever used ea, the best. I just had surgery on shoulder so I can only ask this one question, I am using the ea and it is fore real I would like to start real trading but I only want to start small what is the least do you suggest.
Thanks for this ea
Thanks, I changed the line and it seems to work.
I set limit at 5% (to test) and the usedmargin is stuck now on 4,9% and its not opening new trades.
On the ManageBuy and ManageSell section, the condition was:
if ((1 - (AccountFreeMarginCheck(symb, OP_SELL, lt) / (AccountBalance() + AccountCredit())) * 100 > MaxUsedMargin) //Do not open new cycle of trades if current trades are using more than allowed margin.
return(false);
They should have been:
if ((1 - ((AccountFreeMargin() - AccountFreeMarginCheck(symb, OP_SELL, lt) + AccountMargin())/ (AccountBalance() + AccountCredit())) * 100 < MaxUsedMargin) //Do not open new cycle of trades if current trades are using more than allowed margin.
return(false);
As I believe the original version only checks what's the free margin left after you OPEN a new position instead of considering already opened positions, thus adding the AccountFreeMargin - AccountFreeMarginCheck will get the margin required for the new order, and add to the existing margin (+ AccountMargin) we get the total margin to compare with MaxUsedMargin.
hey Venox250:
I am thinking about implementing a Grid limit. This EA is performing very well, but just one order in the wrong direction will risk a margin call given enough orders in progressive lot sizes... For instance, my EURUSD trade going LONG last week ended up in margin call (demo account, thankfully) as it opened up 6 positions:
0.22
0.22
0.22
0.22
0.50
0.70
if it wasn't for implementing the new margin calculation and no new orders were added, that account would probably gotten margin called even sooner... However, given the fact that the CloseTrigger has been removed, EA could go into a margin call after a 300 to 400 sharp move. This is like a time bomb waiting to go off... (of course, if risk were limited to 0.1%, then arguably you can say it will take 800 pips to margin out, but just recently EURUSD went up 1600 pips in 60 days on the back of Fed's QE 2 speculation, so anything is possible)
So there must be a limit to these Grid Average orders, and the initial stop/loss cannot be set at 500, that would essentially wipe out your account... I think the trade logic should be 100 pips SL on the first order, then use standard deviation (30 pips?) and add 2nd entry with 50 pips SL, and maybe add another entry with 30 pips SL... but that's it. If we get stopped out, given the fact that this EA produces so many positive trades daily, it would not have been a huge loss... Also I believe as the market starts to run away from you, i.e. averaging more than 4 times, chances for the market to come back in a short amount of time is not likely, thus it is best to bite the bullet and move on...
I'd love to hear what you think about this,
Thanks,
neo1001
I've limited knowledge of this EA compared to you guys so if this is a stupid remark please forgive me![](https://c.mql5.com/forextsd/smiles/embaressed_smile.png)
But would a simple hedge function not be a whole lot less 'expensive' then a grid as descriped?
Many replies
Hi all,
I see that the thread got hot. I'm a bit late on these
I'll try to reply in the following posts.
First of all, I didn't create the initial xMeter calculation and I didn't bother how it works. It just works.
Symbol weighting is not the same as currency weighting so consider this when You want to do some weighting! xMeter is based on currency weights (which is calculated from symbol prices).
Margin is checked only for entering NEW positions (I mean new symbols). If you change this behaviour You might get into situations from where xMeter won't be able to recover because it is not allowed to open more recovery positions. The margin limit is only for reserving the remaining equity for recovery positions!!! This is exacly what the comments say. 10% is usually big enough for allowing new positions and the remaining 90% should provide enough cover is things don't go well.
In Your scenario (40% risk) you are risking huge drawdowns and if it happens the remaining 60% of your equity is very little to provide cover (with 40% you might get 3-4 symbols in drawdown and they eat up equity real fast). If you had 10%, you probably won't have more than 2 symbols causing drawdown and the remaining 90% will be able to provide cover (while opening more positions to be able to exit earlier).
If the system eats up the allowed margin it will only open recovery positions it won't start trading on any new pair.
Recommended start account is $1000 with 0.01 lots (or equivalent on cent based accounts) and at least 1:200 (I use 1:500) leverage. Any lower account balance will risk blowing up account because of too little remaining margin.
I don't have time for other answers. Please read the code and the thread before attempting this kind of changes and to understand expected behaviour.
Regards,
Mikki