Thread: EA Usage Tricks
View Single Post
  #3 (permalink)  
Old 09-14-2007, 09:22 AM
jlpi's Avatar
jlpi jlpi is offline
Senior Member
 
Join Date: Oct 2006
Posts: 293
jlpi is an unknown quantity at this point
Quote:
Originally Posted by etrade View Post
In ASCTrend EA, the trade system is:

PHP Code:
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.
Reply With Quote