EA Usage Tricks

 

It is very helpful if people share their tricks in using EAs

For instance, I have a problem with using EA, as when I open MT4, EA will open a trade according to its signal (trend direction), though it may be the end of the trade.

One solution is to keep EA inactive, then upon appearing first opposite signal, activate it.

Is there any other way (I am sure there is) ...

I also have another problem:

When the trade reaches the TP, it will be closed, but as EA feels the same trade direction, it will open another trade in the same direction. In fact, I want to know how can I set EA to do trade only one time after each signal change....

 

In ASCTrend EA, the trade system is:

if (!ExistPositions()){//2

if (PS){//3

OpenSell();

return(0);

}//3

if (PB){//3

OpenBuy();

return(0);

}//3

}//2

if (ExistPositions()){//2

if(OrderType()==OP_BUY){//3

if(EnableCloseByASCTrend){//4

if (PS){//5

CloseBuy();

return(0);

}//5

}//4

}//3

if(OrderType()==OP_SELL){//3

if(EnableCloseByASCTrend){//4

if (PB){//5

CloseSell();

return(0);

}//5

}//4

}//3

How can I modify it to persuade EA 1. to trade only one time after each signal change 2. when opening MT4, wait for the next signal change

Thanks

 
etrade:
In ASCTrend EA, the trade system is:
if (!ExistPositions()){//2

if (PS){//3

OpenSell();

return(0);

}//3

if (PB){//3

OpenBuy();

return(0);

}//3

}//2

if (ExistPositions()){//2

if(OrderType()==OP_BUY){//3

if(EnableCloseByASCTrend){//4

if (PS){//5

CloseBuy();

return(0);

}//5

}//4

}//3

if(OrderType()==OP_SELL){//3

if(EnableCloseByASCTrend){//4

if (PB){//5

CloseSell();

return(0);

}//5

}//4

}//3

How can I modify it to persuade EA 1. to trade only one time after each signal change 2. when opening MT4, wait for the next signal change

Thanks

A way to do it is to use a global variable. It is pretty simple.

For instance you set it to 1 when you open a BUY and -1 if you open a SELL.

And then to open a new order you check what is the value of this variable.

You can reset the variable to 0 for instance if a new signal appears.

And you do not open a new BUY if the variable = 1.

I hope it is clear.

Reason: