Forex



Go Back   Forex Trading > Downloads > Expert Advisors - Metatrader 4
Forex Forum Register More recent Blogs Calendar Advertising Others Help






Register
Welcome to Forex-TSD!, one of the largest Forex forums worldwide, where you will be able to find the most complete and reliable Forex information imaginable.

From the list below, select the forum that you want to visit and register to post, as many times you want. It’s absolutely free. Click here for registering on Forex-TSD.

Exclusive Forum
The Exclusive Forum is the only paid section. Once you subscribe, you will get free access to real cutting-edge Trading Systems (automated and not), Indicators, Signals, Articles, etc., that will help and guide you, in ways that you could only imagine, with your Forex trading.
  • Elite Section
    Get access to private discussions, specialized support, indicators and trading systems reported every week.
  • Advanced Elite Section
    For professional traders, trading system developers and any other member who may need to use and/or convert, the most cutting-edge exclusive indicators and trading systems for MT4 and MT5.
See more

Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old 05-21-2006, 10:54 PM
dr_waleed's Avatar
Junior Member
 
Join Date: May 2006
Location: EgypT
Posts: 9
dr_waleed is on a distinguished road
Help

Please ,

Can anyone help me to add money managment 10% to my first EA

With explain inside the EA please
Attached Files
File Type: mq4 Waleed Expert v1.1.mq4 (2.5 KB, 25 views)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!StumbleUpon this Post!Reddit this Post!Facebook this Post!BlinkList this Post!Google Bookmarks this Post!Yahoo! My Web this Post!
Reply With Quote
  #2 (permalink)  
Old 05-21-2006, 11:10 PM
firedave's Avatar
Senior Member
 
Join Date: Nov 2005
Location: Jakarta, Indonesia
Posts: 414
firedave is on a distinguished road
I hope this is what you want, attached is the revised EA. Hope this help

PHP Code:
//+------------------------------------------------------------------+
//|                                            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 adxcradxprema8crema8prema23crema23pr;
  
      
adxcr=iADX(NULL014PRICE_CLOSEMODE_MAIN,1);
      
adxpr=iADX(NULL014PRICE_CLOSEMODE_MAIN,2);
      
ema8cr=iMA(NULL080MODE_EMAPRICE_CLOSE,0);
      
ema8pr=iMA(NULL080MODE_EMAPRICE_CLOSE,2);
      
ema23cr=iMA(NULL0230MODE_EMAPRICE_CLOSE,0);
      
ema23pr=iMA(NULL0230MODE_EMAPRICE_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(MMLots 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 && ema23pr<ema8pr && ema23cr>ema8cr){
      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);

Attached Files
File Type: mq4 Waleed Expert v1.1.mq4 (4.2 KB, 33 views)
__________________
David Michael H
"Trader helps traders with sincerity, honesty and integrity"

Last edited by firedave; 05-21-2006 at 11:13 PM. Reason: little mistake
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!StumbleUpon this Post!Reddit this Post!Facebook this Post!BlinkList this Post!Google Bookmarks this Post!Yahoo! My Web this Post!
Reply With Quote
  #3 (permalink)  
Old 05-21-2006, 11:33 PM
dr_waleed's Avatar
Junior Member
 
Join Date: May 2006
Location: EgypT
Posts: 9
dr_waleed is on a distinguished road
Thank u very much firedave

that's it
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!StumbleUpon this Post!Reddit this Post!Facebook this Post!BlinkList this Post!Google Bookmarks this Post!Yahoo! My Web this Post!
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off
Forum Jump


All times are GMT. The time now is 10:55 AM.



Search Engine Friendly URLs by vBSEO 3.2.0 ©2008, Crawlability, Inc.