Featured Martingale EA to explore and expand, provided by a programmer

 

I'm offering one of my own EA creation for people who want to explore martingale type of system. Because this is written by me, so it would be relatively easy for me to modify and expand it if I see the requests.

I have written a lot of grid system for people in the past, some are martingale, some focused on hedge elements, in short these are systems that is created with an effort to recover losing trades without using straight forward stop loss. They may be look different under different rules, but the core part of the EAs are very similar. So I'm thinking maybe this can help some people.

There are inherit weakness of this type of system. As lot size of trades becomes bigger, there could potential be a point that accounts being traded won't have sufficient balance to continue to trade, the so called death trade. Countless study probably has been done to reduce the risk.

Even I'm calling it basic or universal template, it offers the most essential element of most martingale system, and in some ways more than most. And this is a very versatile structure that can be easily expended and modified into countless variations. For example, instead of using random entry, you can choose to use controlled entry using indicators, instead of signal basket of trades, you can choose to trade multiple basket of trades and EA can modify them all separately by separate rules, or combine hedge and recovery systems. The structure of this EA makes it possible to manage every single trades differently even if you have 100 trades. Those are for later, first thing first.

This base template EA will operate this way:

When first put on this EA, it'll put on either a buy or sell based on user's choice. I call this primary trade. If primary trade end up hitting take profit, then another primary trade will open which has the same lot size but opposite direction and cycle restart again. If price goes against you, then EA will put on another order of the same type at set distance, I call these recovery trades, until it reaches a max number of recovery trades. The entire baskate of trades will be closed by 3 ways:

1. There will be an emergency stop loss for the entire group, if entire group pip loss reaches a certain point, all trades will exit.

2. If entire group pip gain reaches a certain point, all trades will exit.

3. If entire group dollar gain (or whatever currency you are trading) reaches a certain point, all trades will exit.

The following video is a detailed demonstration of how to use this EA. If there is enough interest, I will post more complicated versions of martingale system in the future.

CL-Martingale base template.mp4 - YouTube

Enjoy!

EA is attached here: cl-martingale_base_template.mq4

Important note: This code has been thoroughly tested although I'm not recommending you to trade live accounts and will not be responsible for any loss anyone has uncounted by using this EA whatsoever.

Important note 2: The features I have included in this EA is not unique to anyone's idea, that's why I'm calling it universal version. So I don't consider anyone's copyright is being violated. I wrote the code completely from scratch myself and use partially on my own client's EAs of similar type. I will be posting ex4 only just in case.

==============================================================

The following are all subsequent versions, they are made for different purposes, not because previous version have bugs.

1. CL-Martingale 111101 cl-martingale_111101.ex4

This version is modified based on the base template, giving user one more option to close the entire group of trades at a predefined dollar loss amount.

2. CL-Martingale 111104 cl-martingale_111104.ex4

This version is modified based on CL-Martingale 111101, primary order entry is based on MACD condition. Details can be found in this video.

CL Martingale 111104 - YouTube

 

Christina,

Thank you VERY much for sharing this EA. That's very kind of you! The video was excellent too!

I ran the EA on EURUSD tester and I'm not quite clear on the Emergency Stop. It LOOKS like the Emergency Stop is the number of pips from the first entry. I thought it would be in dollars, but when running the ea, it went way beyond the Emergency Stop value I had set (thinking it was dollars).

Since we typically only want to risk a certain percentage of our account (say 10%, or 20%) would it be possible to allow the Emergency Stop to be set in Dollars? Or, perhaps be allowed to enter a percentage of our account we want to risk?

Just to make sure I'm being clear, let's say we start trading with an account size of $10,000. If we set the Emergency Stop to $2,000 then all trades would close if the open equity draw down reached -$2000. Of, if the input were to be a percentage, we could enter 20% and all trades would close if we reached 20% draw down in open equity.

Again,

Thank you for this absolutely great EA!!! I've run a lot of martingale grids, and I really like the way you have programmed this one!

Joe

 

Christina,

After further testing I see the Emergency Stop is in Pips for the total position.

Again, thanks for this EA. Its testing out great, even on Oil!

Joe

 
Trade1953:
Christina,

After further testing I see the Emergency Stop is in Pips for the total position.

Again, thanks for this EA. Its testing out great, even on Oil!

Joe

Hi, Joe,

Thanks for trying this out. This is simply an introduction EA and my purpose is to discuss with people, see what other people are thinking and develop a good martingale overtime. Because I'm a programmer so we have the advantage of making it anything we wanted, and I have done a lot of martingale already. It'll probably perform better if we control the first entry using certain conditions instead of just random orders.

Yes the emergency stop is pip loss on the entire group. Because there's a max number of trades limit, so it's not impossible for price to keep going against you. This way at least we have some solution for that.

Thanks again.

 

Hey Christina,

I know this EA is your starting point, and it sure is a great one! With Martingales, I strongly believe Account Management is the most import aspect of succeeding. I'd still like to try and talk you into using (or adding) the capability for the EA to Close all Positions if the Account Balance reaches a set Negative Dollar amount (or Percentage of the Account) in drawdown.

Emergency Exit: Using Pips is OK. But part of the problem is that the different pairs have different pip value in dollars. Also, as positions are added, the drawdown in dollars can change dramatically. If my total position size is 5 Lots, each pip is worth $50 (roughly). If my position size is .1 Lot, each pip is $1. So once the positions pass the max trades (levels) the drawdown in dollars per Pip can be significantly different. It all depends on the total Lots we are in once the last grid level (max trades) is exceeded.

For those who may not understand what I'm saying, here's a quick example. (This isn't exact since there will already be X Pips lost in the trade before the last entry, but it will give you the idea.) Lets say my Max Trades (levels) is 10. The emergency exit is 200 Pips. Assume EURUSD where 1 Lot is $10 a pip.

1. If I'm in a position of 6 Lots when the Max Trades kicks in and the market continues to move against me, each Pip is $60. If my Emergency Exit of 200 pips is hit, the Loss on the Account is $12,000 (or somewhat less).

2. If I'm in a position of 2 Lots when the Max Trades kicks in and the market continues to move against me, each Pip is $20. If my Emergency Exit of 200 pips is hit, the Loss on the Account is $4,000( or somewhat less).

If we were able to set an Exit at some dollar amount, or percentage of our account, it wouldn't matter how many lots we were in once the Max Trades is hit. The positions would simply close when the drawdown limit was hit. It would also give more breathing room for the trade to work, especially with smaller lot sizes. It would also save a lot of calculations for the user to try and figure out how many lots their positions would be in if the max trades were exceeded, and then multiplying the pip value, then backing into what the original starting lot size would have to be to trade within their Account size. Please??

Entry: I have two suggestions for the starting point.

1. I trade an EA called Mandarine Martingale. It uses Support and Resistance to set its initial entry. This EA does really well with a high percentage of wins. I'm sure it will crash one of these days, but I haven't see it do that so far. Max DD around 10% (except on GBPAUD, it should not be traded on this pair with less than $10K).

2. I also trade SWB Grid. It uses Bollinger Bands, Stochastics, and RSI for Entry filters. I have Bollinger Band filter turned off since it seems to hurt the performance more than help. This EA does really well too.

I got both these EAs off the internet somewhere for free, so I can post them if you need me to. Mandarine code is locked, SWB grid is not.

Again, thank you Christina for what you are doing here!!

Joe

 
Trade1953:
Hey Christina,

I know this EA is your starting point, and it sure is a great one! With Martingales, I strongly believe Account Management is the most import aspect of succeeding. I'd still like to try and talk you into using (or adding) the capability for the EA to Close all Positions if the Account Balance reaches a set Negative Dollar amount (or Percentage of the Account) in drawdown.

Emergency Exit: Using Pips is OK. But part of the problem is that the different pairs have different pip value in dollars. Also, as positions are added, the drawdown in dollars can change dramatically. If my total position size is 5 Lots, each pip is worth $50 (roughly). If my position size is .1 Lot, each pip is $1. So once the positions pass the max trades (levels) the drawdown in dollars per Pip can be significantly different. It all depends on the total Lots we are in once the last grid level (max trades) is exceeded.

For those who may not understand what I'm saying, here's a quick example. (This isn't exact since there will already be X Pips lost in the trade before the last entry, but it will give you the idea.) Lets say my Max Trades (levels) is 10. The emergency exit is 200 Pips. Assume EURUSD where 1 Lot is $10 a pip.

1. If I'm in a position of 6 Lots when the Max Trades kicks in and the market continues to move against me, each Pip is $60. If my Emergency Exit of 200 pips is hit, the Loss on the Account is $12,000 (or somewhat less).

2. If I'm in a position of 2 Lots when the Max Trades kicks in and the market continues to move against me, each Pip is $20. If my Emergency Exit of 200 pips is hit, the Loss on the Account is $4,000( or somewhat less).

If we were able to set an Exit at some dollar amount, or percentage of our account, it wouldn't matter how many lots we were in once the Max Trades is hit. The positions would simply close when the drawdown limit was hit. It would also give more breathing room for the trade to work, especially with smaller lot sizes. It would also save a lot of calculations for the user to try and figure out how many lots their positions would be in if the max trades were exceeded, and then multiplying the pip value, then backing into what the original starting lot size would have to be to trade within their Account size. Please??

Entry: I have two suggestions for the starting point.

1. I trade an EA called Mandarine Martingale. It uses Support and Resistance to set its initial entry. This EA does really well with a high percentage of wins. I'm sure it will crash one of these days, but I haven't see it do that so far. Max DD around 10% (except on GBPAUD, it should not be traded on this pair with less than $10K).

2. I also trade SWB Grid. It uses Bollinger Bands, Stochastics, and RSI for Entry filters. I have Bollinger Band filter turned off since it seems to hurt the performance more than help. This EA does really well too.

I got both these EAs off the internet somewhere for free, so I can post them if you need me to. Mandarine code is locked, SWB grid is not.

Again, thank you Christina for what you are doing here!!

Joe

Hi, Joe,

I see what you are saying with emergency stops. I personally like to use dollar for calculation as well, this this the what matters and it's most clear.

The reason behind the pip stop is that I found most people like to use pips, and I have assumed it's user's responsibility to make sure the settings to make sense. For example, if you start with lot size of 1, compared to the person who start with 0.1, you better make sure your account is 10 times bigger than the other person. This way with the same pip stop setting, even you lose more dollars in your account, the proportion of loss for your account should be the same.

I will change the emergency stops to have 2 choices, dollar and pip, similar to the take profit.

However when you choose dollar stop settings, once again as the user, you need to be clear what kind of impact of your lot size choice. It won't make much sense if you set the same dollar stop loss, but trading with wildly different lot size as well.

I will make this change over the weekend.

I think I've seen the grid EA on FF. I will soon post a template that allows to open trades based on indicators, that will also allow to change the indicator to any indicator (or combination of indicators) easily.

 

Hey Christina,

Thank You, Thank You, Thank You!

Joe

 

metatrader 5

Any chance of a Metatrader 5 version. I am keen to try this out, but not that keen to return to metatrader 4.

Thanks.

LW

 

Thanks for the ea,

I admit it,this is my first time seeing Martingale EA with alot of features,i really looking forward if you decide to improve this ea and i hope you will.

I have tested it with many pairs and it looks very profitable with correct settings.

 
Lwclasses:
Any chance of a Metatrader 5 version. I am keen to try this out, but not that keen to return to metatrader 4.

Thanks.

LW

Hi, I am able to make conversions to MT5 but at this point I will be focused on improvement on this version based on people's requirements. I will consider to convert after this prove to turn out to be a good one.

I will make those modified version I promised within 2 days. I have too much work left over the weekend.

Thanks.

 
Trade1953:
Hey Christina,

Thank You, Thank You, Thank You!

Joe

I have uploaded to the 1st post a modified version which give both dollar emergency stop and pip emergency stop. Both are applied to the entire group of trades. Detailed explanation in post 1.

Next day or 2 I will post a controlled entry Martingale, everything else will be the same except entry won't be random, using indicators. I will first make a single group EA, however I personally feel this type is best to allow multiple groups to exist at the same time, will post multiple group EA shortly after that.

Reason: