I hope this is what you want, attached is the revised EA. Hope this help
//+------------------------------------------------------------------+
//| Al-Waleed Expert v1.1 |
//| Copyright, created 20 may 2006 |
//| Work on EURUSD, H1 |
//| Dr. Waleed Soliman |
//| dr_waleed@msn.com |
//| 0020122327320 |
//+------------------------------------------------------------------+
#property copyright "Al-Waleed Expert"
#property link "dr_waleed@msn.com"
extern int MaxTrades=1;
// extern double lots=0.1;
extern int stoploss=38,takeprofit=42;
extern bool UseHourTrade = true;
extern int FromHourTrade = 13;
extern int ToHourTrade = 19;
extern string
MM_Parameters = "---------- Money Management";
extern double
Lots = 1;
extern bool
MM = false, //Use Money Management or not
AccountIsMicro = false; //Use Micro-Account or not
extern int
Risk = 5; //10%
int ID=148;
void deinit() {
Comment("");
}
int orderscnt(){
int cnt=0;
for(int i =0;i<OrdersTotal();i++){
if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES)){
if(OrderSymbol()==Symbol() && ID==OrderMagicNumber()){
cnt++;
}
}
}
return(cnt);
}
int start()
{
double adxcr, adxpr, ema8cr, ema8pr, ema23cr, ema23pr;
adxcr=iADX(NULL, 0, 14, PRICE_CLOSE, MODE_MAIN,1);
adxpr=iADX(NULL, 0, 14, PRICE_CLOSE, MODE_MAIN,2);
ema8cr=iMA(NULL, 0, 8, 0, MODE_EMA, PRICE_CLOSE,0);
ema8pr=iMA(NULL, 0, 8, 0, MODE_EMA, PRICE_CLOSE,2);
ema23cr=iMA(NULL, 0, 23, 0, MODE_EMA, PRICE_CLOSE,0);
ema23pr=iMA(NULL, 0, 23, 0, MODE_EMA, PRICE_CLOSE,2);
if (UseHourTrade){
if(!(Hour()>=FromHourTrade&&Hour()<=ToHourTrade)){
Comment("Non-Trading Hours!");
return(0);
}
}
double sl,tp;
//+------------------------------------------------------------------+
//| ADJUST LOTS IF USING MONEY MANAGEMENT |
//+------------------------------------------------------------------+
if(MM) Lots = subLotSize();
if (adxcr>adxpr && ema23pr>ema8pr && ema23cr<ema8cr){
if(orderscnt()<MaxTrades){
if(stoploss==0){sl=0;}else{sl=Bid-stoploss*Point;}
if(takeprofit==0){tp=0;}else{tp=Bid+takeprofit*Point;}
OrderSend(Symbol(),OP_BUY,Lots,Ask,2,sl,tp,"Al-Waleed",ID,0,Blue);
PlaySound("Alert.wav");
}
}
if (adxcr>adxpr && ema23prema8cr){
if(orderscnt()<MaxTrades){
if(stoploss==0){sl=0;}else{sl=Ask+stoploss*Point;}
if(takeprofit==0){tp=0;}else{tp=Ask-takeprofit*Point;}
OrderSend(Symbol(),OP_SELL,Lots,Bid,2,sl,tp,"Al-Waleed",ID,0,Red);
PlaySound("Alert.wav");
}
}
return(0);
}
//+------------------------------------------------------------------+
//| FUNCTION DEFINITIONS |
//+------------------------------------------------------------------+
//+------------------------------------------------------------------+
//| FUNCTION : MONEY MANAGEMENT |
//| SOURCE : CODERSGURU |
//| MODIFIED : FIREDAVE |
//+------------------------------------------------------------------+
double subLotSize()
{
double lotMM = MathCeil(AccountFreeMargin() * Risk / 1000) / 100;
if(AccountIsMicro==false) //normal account
{
if(lotMM < 0.1) lotMM = Lots;
if((lotMM > 0.5) && (lotMM < 1)) lotMM = 0.5;
if(lotMM > 1.0) lotMM = MathCeil(lotMM);
if(lotMM > 100) lotMM = 100;
}
else //micro account
{
if(lotMM < 0.01) lotMM = Lots;
if(lotMM > 1.0) lotMM = MathCeil(lotMM);
if(lotMM > 100) lotMM = 100;
}
return (lotMM);
}
Thank u very much firedave
that's it

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Please ,
Can anyone help me to add money managment 10% to my first EA
With explain inside the EA please