New EA based on the !xMeter - page 45

 
qwertymyfx:
30% winning rate isn't very good, is it?

If You tell 'winning rate' then it's above 60%. If You mean 'good trades' (TP hit with no recovery positions) then it's about 30%.

It depends. As far as I know many profitable manual strategies have less than 50% winning ratio. It all comes down to profitability. xMeter is profitable so I'm fine with this ratio.

Many martingale-like strategies have above 95% win ratio and still are not profitable... Win ratio in itself doesn't tell much about a strategy.

 

I Don't understand the margin calculation.

I've got a demo running with $84172

It has one trade that is currently -$2700

It says it uses 17% margin (out of 15% permitted)

How is 2700 17% of 84172?

 
fate:
I Don't understand the margin calculation.

I've got a demo running with $84172

It has one trade that is currently -$2700

It says it uses 17% margin (out of 15% permitted)

How is 2700 17% of 84172?

First of all: You should get a clear understanding how does leveraged trading work. This calculation has nothing to do with xMeter.

Margin calculation is as follows:

(Account_Total_Equity - Free_Margin) / Account_Total_Equity

where

Account_Total_Equity is AccountBalance + AccountCredit,

Free_Margin is the usable margin.

Free_Margin is calculated as follows:

Account_Total_Equity + Profit_Loss - Margin

where

Profit_Loss is the actual sum of profit/loss of open trades.

In Your case:

Account_Total_Equity = 84172

Profit_Loss = -2700

(Account_Total_Equity - Free_Margin) / Account_Total_Equity = 0.17

which gives us:

Free_Margin = 69863

Margin = 11609

So the only one open position requires roughly $11609 margin from your account which is very high! I guess you are using 1:100 leverage which is not recommended or your AccountRiskPercent is too big. Is it true?

Recommended settings are 1:500 leverage and 0.10 AccountRiskPercent and at least 100000 times bigger equity than minimal allowed lot size (that is $1000 for 0.01 lots).

And please note: xMeter cannot distinguish other trades (trades open not by EA) when calculating margin. It calculates margin for the whole account.

 

Hi Venox,

Thanks, I had the feeling I was missing something when I typed that message .

You are right, the risk percentage is way to high, I'm playing with it to get a feeling for the settings. I won't mess up this great thread anymore with my newbie remarks

 
fate:
Hi Venox,

Thanks, I had the feeling I was missing something when I typed that message .

You are right, the risk percentage is way to high, I'm playing with it to get a feeling for the settings. I won't mess up this great thread anymore with my newbie remarks

It's okay to ask but make sure to choose the right thread for it. And search before asking. I'd recommend reading babypips.com and similar sites as a general introduction to trading.

 
venox250:
If You tell 'winning rate' then it's above 60%. If You mean 'good trades' (TP hit with no recovery positions) then it's about 30%.

It depends. As far as I know many profitable manual strategies have less than 50% winning ratio. It all comes down to profitability. xMeter is profitable so I'm fine with this ratio.

Many martingale-like strategies have above 95% win ratio and still are not profitable... Win ratio in itself doesn't tell much about a strategy.

Well, I for one agree with Venox that 30% winning without recovery, and about 67% winning with recovery is exceptional... the bottomline is that this EA is making money consistently...

However, what I wanted to do is to improve on that overall 67% winning rate, while reducing the overall risk. I have also noticed that depending on when you start your trading, i.e. 4pm EST or 4am EST, it matters a lot, because you could get into a trade that turns into recovery, then you will have to wait painfully for it to come back...

Since this EA has access to the overall strength and weakness of all major currencies, I am thinking about creating a few rules, which I think was something that is very important but often overlooked... For example:

Risk Appetite - Generally takes place when safe haven currencies, such as JPY, USD, or even CHF, are weak, while commodities currencies such as NZD, AUD, CAD, and sometimes EUR and GBP, gain across the board... So the EA should look for USD and JPY weakness, and if that's the case, use the filter by swap routine and put all postive swap trades on the top of the list and filter out trades that consists of the strong currencies (meaning must trade either a USD or JPY cross).

Risk Aversion - Generally takes place when market is in fear of volatility, investors want safety, thus USD and JPY are highly in demand. CHF should also show strength, but this depending on whether of not SNB (Swiss National Bank) intervention stance. I believe if we see both USD and JPY gaining, pairs such as AUDUSD, AUDJPY, GBPJPY, EURUSD, should all drop... so we should take trades that is opposite of swap mode 1 - better direction, we should take worse direction for the risk aversion sentiment....

Of course other sentiments such as one single currency gaining against all other majors, it could mean that there are possible news catalysts driving the market... So if GBP is gaining across the board, we can actually look at that sentiment and determine the best default pair to trade. During European sessions, focus should be on the EURGBP, and during NY Session, we can focus on GBPUSD...

So things like that should add to the overall profitability, but of course, this rule would come a bit complicated... Just an idea I wanted to throw out, see if anyone is interested or have something to add.

neo1001

 
neo1001:
Well, I for one agree with Venox that 30% winning without recovery, and about 67% winning with recovery is exceptional... the bottomline is that this EA is making money consistently...

However, what I wanted to do is to improve on that overall 67% winning rate, while reducing the overall risk. I have also noticed that depending on when you start your trading, i.e. 4pm EST or 4am EST, it matters a lot, because you could get into a trade that turns into recovery, then you will have to wait painfully for it to come back...

Since this EA has access to the overall strength and weakness of all major currencies, I am thinking about creating a few rules, which I think was something that is very important but often overlooked... For example:

Risk Appetite - Generally takes place when safe haven currencies, such as JPY, USD, or even CHF, are weak, while commodities currencies such as NZD, AUD, CAD, and sometimes EUR and GBP, gain across the board... So the EA should look for USD and JPY weakness, and if that's the case, use the filter by swap routine and put all postive swap trades on the top of the list and filter out trades that consists of the strong currencies (meaning must trade either a USD or JPY cross).

Risk Aversion - Generally takes place when market is in fear of volatility, investors want safety, thus USD and JPY are highly in demand. CHF should also show strength, but this depending on whether of not SNB (Swiss National Bank) intervention stance. I believe if we see both USD and JPY gaining, pairs such as AUDUSD, AUDJPY, GBPJPY, EURUSD, should all drop... so we should take trades that is opposite of swap mode 1 - better direction, we should take worse direction for the risk aversion sentiment....

Of course other sentiments such as one single currency gaining against all other majors, it could mean that there are possible news catalysts driving the market... So if GBP is gaining across the board, we can actually look at that sentiment and determine the best default pair to trade. During European sessions, focus should be on the EURGBP, and during NY Session, we can focus on GBPUSD...

So things like that should add to the overall profitability, but of course, this rule would come a bit complicated... Just an idea I wanted to throw out, see if anyone is interested or have something to add.

neo1001

Nice ideas I like them. You should implement it to see how it performs.

One of my previous ideas was to add a market open/close time to each of the 112 known currencies. With this knowledge symbols could be prioritized based on market status (open/close). Symbols with both currencies on open market could be put on top of tradeable list. This method also requires knowing the timezone of the broker EA is running on.

I didn't implement this because it was too complicated for the first run and I messed up the code Maybe a second run would be better.

 

Please Correction

neo1001:
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);

.

Neo, I think that your as Venox contibution here is great .

At the above quote you suggested to fix a small eror.

As you can see you have extra "(". How to correct it? Thanks.

 

I really like the aversion/appetite idea. Given enough time I could probably program it myself to test, but don't lose sleep waiting for me to do it!

I'm not so convinced that both markets need to be open to be profitable, perhaps another way of doing it would be to say if neither market is open don't trade it. Having said that, Venox has done a great job so far, so who am I to doubt it?

Something else I intend to implement is to have a different maximum spread allowed for each pair. A spread of 10 may be okay for something more obscure like EURNZD, but not for something like EURUSD, so it would be nice to limit this. Obviously it's something I'll have to hard program for my own use as every broker will have different tradeable pairs with different spreads.

 
neo1001:
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.

I re-read this post from neo again.

I have to disagree with this suggestion. The AccountFreeMarginCheck() does consider already existing positions, look up the manual.

I have to again stress that margin limit is only accounted for when opening the first position on a pair. Recovery positions do not use the margin check! The intended behaviour is to reserve the most part of the margin for recovery positions.

If You want xMeter to obey a global margin limit and not to open any more positions after that limit is reached then the whole margin concept should be replaced which cannot be done by changing 2 lines of code.

Please, understand the whole code before doing modifications. I didn't ask anybody about xMeter's behaviour before posting my first update but spent about a month to try to understand it's behaviour. I guess I did it well since xMeter 2.1 is working quite well. Read the posts, run demo, analyze code, ask for info if needed and then do the changes. This way You can be sure that you won't mess up the code.

Reason: