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
05-21-2006, 10:54 PM
Junior Member
Join Date: May 2006
Location: EgypT
Posts: 9
Help
Please ,
Can anyone help me to add money managment 10% to my first EA
With explain inside the EA please
05-21-2006, 11:10 PM
Senior Member
Join Date: Nov 2005
Location: Jakarta, Indonesia
Posts: 414
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 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 && 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 );
}
__________________
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
05-21-2006, 11:33 PM
Junior Member
Join Date: May 2006
Location: EgypT
Posts: 9
Thank u very much firedave
that's it
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
Thread Tools
Display Modes
Linear Mode
Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
All times are GMT. The time now is 10:55 AM .