Thread: Martingale EA
View Single Post
  #299 (permalink)  
Old 01-30-2008, 05:01 AM
wolfe's Avatar
wolfe wolfe is offline
Senior Member
 
Join Date: Jan 2006
Posts: 820
wolfe is on a distinguished road
v1_5

It's been 3 weeks since the beginning of this EA project. I have just finished the fifth version of the EA.

I tried to simplify the code a bit, however I'm sure that more can be done. I also keep adding additional options, which doesn't necessarily make the code simpler.

I have added a money management option, as well as a start long, or start short feature. The user now has 4 options to start the first trade with, as well as many other options for how you want the EA to operate. Don't ask me for the best set up, because I don't know it yet.

Anyone using v1_5 for the first time will need to review and understand the external variables, there have been some changes:
PHP Code:
extern double  Start_Lot_Size=0.1;//starting lot size for cycle
extern double  Lot_Size_Increment=0;//Additional orders will increase by this amount
extern bool    Money_Management=false;//if true mm is used, if false lot size will be start_lot_size
extern double  Risk_Percent=1;//percent risk of your AccountFreeMargin() for starting lot size
extern double  Min_Lots 0.1;//minimum lot size if using money management
extern double  Max_Lots 5.0;//maximum lot size if using money management  
extern bool    Auto_Restart=false;//set to true if you want EA to re-start after each cycle
extern bool    Double_Lotsize=false;//set to true if you want to just double every lotsize, Lot_Size_Increment ignored if true
extern int     Max_Trades=50;//maximum number of trades allowed
extern bool    Close_All_Max=false;//select true if you want ALL orders to close if Max_Trades is hit 
extern int     Next_Trade=10;//next trade pip increment, (will trade this many pips above OR below last order)
extern bool    Close_By_Percent=false;//If true it will close by percent, if false it will close by Profit or Loss in $$
extern double  TP_Percent=5;//will take profit if profit is greater than percent of account balance (close all orders)
extern double  SL_Percent=10;//will stop loss if profit is less than percent of account balance (close all orders)
extern double  Close_By_Profit=10;//close if >= to this $ amount
extern double  Close_By_StopLoss=300;//Amount of money to close all if lost
extern bool    Use_MA_Entry=false;//select true if you want moving average to decide starting direction
extern int     MA_Period=7;//moving average period for calculation
extern int     Timeframe=3;//timeframe used for MA calculation, 1=1m, 2=5m, 3=15m, 4=30m, 5=1h, 6=4h, 7=1d
extern bool    Use_Manual_Entry=false;//if selected true you must enter Manuel_Long & Manuel_Short price you want trade to execute
extern double  Manual_Long=0;//Price at which to start cycle long
extern double  Manual_Short=0;//Price at which to start cycle short
extern bool    Start_Long_NOW=false;//if true EA will start long immediately
extern bool    Start_Short_NOW=false;//if true EA will start short immediately
extern int     Slippage=5;//slippage for ordersend command
extern int     Number_Of_Tries=5;//Number of tries to send an OrderSend()command if not going through 
Many options to choose from! Thanks for all the ideas and input.

v1_5 uses the same include file as v1_4. Include file is posted again for those who need it.

Let me know if any bugs are found. As always, happy testing.

-wolfe
Attached Files
File Type: mq4 TFX v1_5.mq4 (31.3 KB, 170 views)
File Type: mqh TFX_Include_v1_4.mqh (2.5 KB, 121 views)
Reply With Quote