Ema Cross! - page 12

 

@codersguru:

thank you for great effort...

After attached your EA (https://www.mql5.com/en/forum/173468/page7) in 4pair eur/usd, gbp/usd, usd/chf, gbp/jpy.... three pair immediately started open trade (gbp/usd, usd/chf, gbp/jpy) and all of them have good result....

I dont know anything about programming... but based on this advised:

gkozlyk:
For the arrows being reversed, just swap the 2 arrow numbers in the code, then problem is solved. Compile afterward for it to take effect on all charts the indicator is applied to Graham

I do make small change in EA:

if(line1>line2)current_direction = 1; //up

if(line1<line2)current_direction = 2; //down

To

if(line1>line2)current_direction = 2; //up

if(line1<line2)current_direction = 1; //down

Yesterday, I attached this EA to neuimex demo account TF30 in four pair.... and all of them have good result to....

I will continue to forward testing those EA for another 2/3 weeks....

 

In the next modification i might put in another switch so if users want to do reverse trades on the cross they can (as in if the fast EMA goes above the slow, you do a sell). In my visual backtesting, it seems less profitable than going with the cross immediately then as the trades gets older looking for a reverse trade.

Another idea i had was to maybe wait a bar to take the trade after the cross (this might prevent those times the currency pokes through then goes the other way)

I found another EMA cross program on this website had some good ideas.

https://www.mql5.com/en/forum/173445

 

Codersguru,

With respect to the MM part of trading.

Starting with 10,000$ account:

(account equity * risk %)/ largest loss = lots to trade

(10,000* 10%)/ 50= 2 lots

This is assuming SL is 50pips.

So the account has to be adjusted every trade with this formula.

I hope this helps.

But before you incorporate this formula, please tell me what kinda

win/loss ratio and risk/reward ratio are you expecting for this system.

We can then build once we know that.

Accordingly we can adjust the risk % to 10 or 15%.

Also your typical largest loss will be equal to your SL since that will be maximum you can loose on any one trade. The risk % also has to take into account maximum drawdown or largest consecutive losses so that we can tide over the drawdown.

Hope that helps. Anyone disagree with this MM please point it out so that we improve.

The results which we get in a backtest usually just takes a standard 1 lot trade for every trade. So if we incorporate MM, the equity growth is multiplied by several times. That is the magic of MM.

Most people concentrate on finding the best systems, but the real holy grail is MM. You can make an average system into a super system by MM itself.

As I had pointed out in my earlier post, the following example will make it obvious.

win - 74%

Without Money Management

Initial equity - 20,000$

Final Equity - 251,813$

With MM

initial equity - 30,000$

Final equity - 582,930,624 $$$$$$$$$$$$$$$

Thats right! thats 5.82 million $!

The values are theoritical, however the message is pretty clear.

 
dedywind:
@codersguru:

thank you for great effort...

After attached your EA (https://www.mql5.com/en/forum/173468/page7) in 4pair eur/usd, gbp/usd, usd/chf, gbp/jpy.... three pair immediately started open trade (gbp/usd, usd/chf, gbp/jpy) and all of them have good result....

I dont know anything about programming... but based on this advised:

I do make small change in EA:

if(line1>line2)current_direction = 1; //up

if(line1<line2)current_direction = 2; //down

To

if(line1>line2)current_direction = 2; //up

if(line1<line2)current_direction = 1; //down

Yesterday, I attached this EA to neuimex demo account TF30 in four pair.... and all of them have good result to....

I will continue to forward testing those EA for another 2/3 weeks....

You have reversed the direction of the cross, EMA CROSS will work in both directions but it originally based on taking the reverse direction of the market.

 

New version

Hi folks,

Firstly, I want to thank you all for your shares and useful comments

Secondly, I have updated the EMA CROSS expert advisor to version 2.

I hope you find it useful!
 

I try to do the back for 1 and 2 codersguru ea ,test on eur/usd ,D1 it open .5 lot . Donno what I click ,I lost the result test on forward demo acct for 1 week it is up $# 1025 # . only on eur/usa .

Files:
2_1.gif  9 kb
 

A question

Hi codersguru and all members

I have a question and I am newbie in forex.

Can we use an EA in offline? or we must be online for using an EA?

 

Coders Guru

I have quickly looked at the codeing of your new version and have a few questions about the code.

The first has to do with this block of code below;

static int TimeFrame;

...

...

...

int init()

{

TimeFrame=Period();

return(0);

}

...

...

...

int Crossed (double line1 , double line2)

{

static int last_direction = 0;

static int current_direction = 0;

if(TimeFrame!=Period())

{

TimeFrame=Period();

return (0);

}

if(line1>line2)current_direction = 1; //up

if(line1<line2)current_direction = 2; //down

...

...

...

[/CODE]

What is the purpose of the TimeFrame Parameter in this content?

The second code block that is giving me some questions is the purpose of the function isNewSymbol?

[CODE]

bool isNewSumbol(string current_symbol)

{

//loop through all the opened order and compare the symbols

int total = OrdersTotal();

for(int cnt = 0 ; cnt < total ; cnt++)

{

OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES);

string selected_symbol = OrderSymbol();

if (current_symbol == selected_symbol)

return (False);

}

return (True);

}

...

...

...

total = OrdersTotal();

if(total < 1 || isNewSumbol(Symbol()))

{

if(isCrossed == 1)

...

...

...

I know that you are very busy but could you please explain the purpose of these and why they are needed.

Thanks for your time,

The CockeyedCowboy

 

Blocks of code!

cockeyedcowboy:
Coders Guru

I have quickly looked at the codeing of your new version and have a few questions about the code.

The first has to do with this block of code below;

static int TimeFrame;

...

...

...

int init()

{

TimeFrame=Period();

return(0);

}

...

...

...

int Crossed (double line1 , double line2)

{

static int last_direction = 0;

static int current_direction = 0;

if(TimeFrame!=Period())

{

TimeFrame=Period();

return (0);

}

if(line1>line2)current_direction = 1; //up

if(line1<line2)current_direction = 2; //down

...

...

...

[/code]

What is the purpose of the TimeFrame Parameter in this content?

The second code block that is giving me some questions is the purpose of the function isNewSymbol?

[code]

bool isNewSumbol(string current_symbol)

{

//loop through all the opened order and compare the symbols

int total = OrdersTotal();

for(int cnt = 0 ; cnt < total ; cnt++)

{

OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES);

string selected_symbol = OrderSymbol();

if (current_symbol == selected_symbol)

return (False);

}

return (True);

}

...

...

...

total = OrdersTotal();

if(total < 1 || isNewSumbol(Symbol()))

{

if(isCrossed == 1)

...

...

...

I know that you are very busy but could you please explain the purpose of these and why they are needed.

Thanks for your time,

The CockeyedCowboy

CockeyedCowboy,

I used the first block of code to be sure that the changing of the chart period will not affect the program.

For example: if you attached the expert advisor to M30 chart and the Short EMA line was above the Long EMA line in the M30 chart, Then you clicked the D1 button and changed the timeframe to daily timeframe and the you was unlucky and the Short EMA line in the D1 chart was below the Long EMA in this chart. The expert advisor will consider it a crossing and open a trade. But with the above code i give it a chance to remember the last time frame and wait for another tick.

I used the second block of code to check the currently opened trades and prevent the expert advisor to trade in the same pair twice.

 

Thanks!

Audio:
I try to do the back for 1 and 2 codersguru ea ,test on eur/usd ,D1 it open .5 lot . Donno what I click ,I lost the result test on forward demo acct for 1 week it is up $# 1025 # . only on eur/usa .

Audio,

Thank you very much , I hope to see you making 1025 x Million in a real account too soon.