EA close orders when 2 ema cross

 

hi dears,

I open my orders manually, so I'm looking for an EA that can close all open and pending orders when 2 ema cross

for example: if the cross happen between 5 ema and 8 ema , the ea will close all open and pending orders

if the cross between the 2 ema happen again , the ea will close all orders again

thanks in advance

 

...

Regardless of the opened position(s) type and the direction of the cross?

wowos:

hi dears,

I open my orders manually, so I'm looking for an EA that can close all open and pending orders when 2 ema cross

for example: if the cross happen between 5 ema and 8 ema , the ea will close all open and pending orders

if the cross between the 2 ema happen again , the ea will close all orders again

thanks in advance

 

If it does not matter (the type and the direction of the cross), than this EA will do the job for you

mladen:
Regardless of the opened position(s) type and the direction of the cross?
Files:
 

Close on MA Cross - Any chance of adding BE plus 1 for 35 pips profit

mladen:
If it does not matter (the type and the direction of the cross), than this EA will do the job for you

Is this EA control all open trades in all currency pairs?

 

Close on EMA crosses and BreakEvenExpert

mladen:
If it does not matter (the type and the direction of the cross), than this EA will do the job for you

I Tried to combine this two EA into one but I have three errors. Can anybody who is good in programming correct the code to get this EA working.

Errors are: T expression on global scope not allowed

Function "TrailStops" is not referenced and will be removed from exp-file

Function "ScanTrader" is not referenced and will be removed from exp-file

The code is attached.

Do not miss the UK, London Olympics today 27/7/2012 from 1900 GMT. It is my London city and it is wonderful to be here.

 
charleslimuk:
I Tried to combine this two EA into one but I have three errors. Can anybody who is good in programming correct the code to get this EA working.

Errors are: T expression on global scope not allowed

Function "TrailStops" is not referenced and will be removed from exp-file

Function "ScanTrader" is not referenced and will be removed from exp-file

The code is attached.

Do not miss the UK, London Olympics today 27/7/2012 from 1900 GMT. It is my London city and it is wonderful to be here.

I am grateful that KennyHubbard from Donnaforex has corrected the compilation errors and now the BreakEven and close at EMA cross EA is now complete.

 
charleslimuk:
I am grateful that KennyHubbard from Donnaforex has corrected the compilation errors and now the BreakEven and close at EMA cross EA is now complete.

After testing this exit and break even EA there is a refinement to add for exiting on fast EMA crosses slow EMA which are as follows:

1) for SELL trade the fast EMA must cross the slow EMA from bottom to the top or

2) for BUY trade the fast EMA must cross the slow EMA from the top to the bottom.

Can anyone who is experience in MT4 programming help to add these two conditions before the EA exits the trade?

 
charleslimuk:
After testing this exit and break even EA there is a refinement to add for exiting on fast EMA crosses slow EMA which are as follows:

1) for SELL trade the fast EMA must cross the slow EMA from bottom to the top or

2) for BUY trade the fast EMA must cross the slow EMA from the top to the bottom.

Can anyone who is experience in MT4 programming help to add these two conditions before the EA exits the trade?

maybe something like

void CheckToClose()

{

int total=OrdersTotal();

double macdc = iMA(NULL,0,FastEma,0,MODE_EMA,Price,BarToTest )-iMA(NULL,0,SlowEma,0,MODE_EMA,Price,BarToTest );

double macdp = iMA(NULL,0,FastEma,0,MODE_EMA,Price,BarToTest+1)-iMA(NULL,0,SlowEma,0,MODE_EMA,Price,BarToTest+1);

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

{

OrderSelect(cnt, SELECT_BY_POS);

int mode=OrderType();

if ( OrderSymbol()==Symbol() )

{

if ( mode==OP_BUY )

{

if (macdp>0 && macdc<0)

{

OrderClose(OrderTicket(),OrderLots(),Bid,3,Violet);

return(0);

}

}

if ( mode==OP_SELL )

{

if (macdp0)

{

OrderClose(OrderTicket(),OrderLots(),Ask,3,Violet);

return(0);

}

}

}

}

}

with CheckToClose() after scantrades maybe

if (ScanTrades()<1) return(0);

CheckToClose();

its been awhile since i looked at mt code so its prolly wrong somewhere

 

Please help - Please !!

Hi everyone

I was looking for an EA that opens a buy or sell trade trade immediately that price action touches or penetrates a SMA or EMA. I found a very nice EA called "price cross MA" (I've attached it) but it does not open a trade immediately when price line touches the moving average. Nor can you set it to either open a sell trade or a buy trade (depending whether you are expecting price to "bounce" off or whether you expect it to penetrate through). Does anyone perhaps know how to edit it to do those things?

THANKS SO MUCH IF ANYONE CAN HELP!!!

Rgds

Jerry

Files:
 
lowphat:
maybe something like
void CheckToClose()

{

int total=OrdersTotal();

double macdc = iMA(NULL,0,FastEma,0,MODE_EMA,Price,BarToTest )-iMA(NULL,0,SlowEma,0,MODE_EMA,Price,BarToTest );

double macdp = iMA(NULL,0,FastEma,0,MODE_EMA,Price,BarToTest+1)-iMA(NULL,0,SlowEma,0,MODE_EMA,Price,BarToTest+1);

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

{

OrderSelect(cnt, SELECT_BY_POS);

int mode=OrderType();

if ( OrderSymbol()==Symbol() )

{

if ( mode==OP_BUY )

{

if (macdp>0 && macdc<0)

{

OrderClose(OrderTicket(),OrderLots(),Bid,3,Violet);

return(0);

}

}

if ( mode==OP_SELL )

{

if (macdp0)

{

OrderClose(OrderTicket(),OrderLots(),Ask,3,Violet);

return(0);

}

}

}

}

}

with CheckToClose() after scantrades maybe

if (ScanTrades()<1) return(0);

CheckToClose();

its been awhile since i looked at mt code so its prolly wrong somewhere

After adding the above to Brealevenexpert and close when Ema 3 crosses ema20 there are three compilation errors as follows:

1) '(' - function definition unexpected

2) macdc - variable already defined

macdp - variable already defined

See the attached file and please correct it as I am new to MT4.

 

the void would be outside of the int start() {...}

and then CheckToClose() would be called somewhere inside start

i didnt debug so theres prolly mistakes

Reason: