SERIOUS WARNING
- This robot will kill your account if you trade it incorrectly. You must read the trading hours section.
- Even if you take notice of trading hours, this ea will still kill your account if you over-trade.
I received this from mysticgenie earlier tonight:
"Hi Steve,
Here Mystic agan!
I need your help to make a EA on this martingale type system. I have been trading this manually with good results during peak hours.
These are the rules:
I need your help to make a EA out of these simple rules to be traded on EurUSD ( can be in any pair, but I prefer EUrUSD due to low spread).
The EA should be MT4 compatible with 5 digit broker.
These are the rules:
1. Open EurUsd chart 5 min frame.
2. Open a buy order randomly
3. TP 10 pips from the open price; SL 10 pips from the open price ( no need to include spread).
4. Open 1 lot initially ( this should be adjustible with lot change feature with micro and mini lots options).
5. If the position stops out then open sell order with 2 lots with TP and SL 10 pips.
for exmple, you open initially 1 lot buy eurusd at 1.4550. TP 1.4560; SL 1.4540.
current price at 1.4540; you open 2 lots sell at 1.4540 with TP 1.4530, SL 1.4550.
if this hits 1.4530 you will win.
Suppose, price does not hit TP, but moved back to 1.4550, then EA should open buy position with 4 lots.
so the sequence of lots is: 1, 2,4,8,16,32,64,128 (Martingale strategy)
the TP 10, SL 10
the EA should continue to open positions in opposite directions till the price reaches one of the TP levels.
This should not take long since it is only 10 pips.
6. Please make the trading hours adjustible ( that is I can specify the trading hours).
Please let me know if you need any clarification.
Thanks so much in advance,
Mystic "
I coded this just for fun - the only way to treat an ea such as this one.
Newbies, there are two things you need to know about Martingale;
- it will perform fantastically well right up to the point that it blows your account.
- it will blow you account sooner or later. Probably sooner.
One addition to mystic's strategy I have made is to add MaximumAllowableLot to the inputs. When the Martingale sequence exceeds this figure, the bot restarts with a Lot buy trade. The ridiculously high default effectively turns this filter off; it is there for those of you who want to play with limiting the sequence size.
Trading hours
Enter these in your own computer's local time, not your criminal's server time. They should represent the period of a few hours from the start of the European session, or maybe the London opening an hour later. You will have to work this out for yourself.
Copied from post 18: "Turn on during late Asia early London open, and late London and early US market overlap. these times market move significantly no matter what as long as they are open. Monitor your positions if possible. Start with 1 microlot every 1000 usd ( leverage 1:100 or higher). you will get profits and can make 5-10% per month without much sweat."
Initial trade with the trend
This is not part of mystic's strategy.
This ea should be successful so long as there is movement in the market, so I have added my favourite Rsi filter. Choose your own time frame and period, then:
- Rsi >55 or < 45 means the market is trending either up or down, and so the ea will trade
- In between these numbers, the market is ranging and the ea will not trade.
It would be a matter of moments to add code to make the initial trade in the sequence be with the identified trend. Let's see how things go as they are.
Measuring volatility with Bollinger Bands
This is not part of mystic's strategy.
What this strategy really needs is a moving market. Bollinger Bands expand with increasing volatility and shrink as the volatility decreases. I have added a BB filter to see if this helps. Where the bands are expanding the bot will trade; where they are shrinking, it will not trade.
Starting a new trading sequence from scratch
You should only leave this robot on your chart during the appropriate trading hours and should remove it at the end of each session.
At each restart, the bot will start a new trading sequence at your chosen initial lot size. You have the choice of deciding which direction the initial trade in each sequence will be with these inputs:
- StartLongSequence: will send a buy as the initial trade
- StartShortSequence: will send a sell as the initial trade
If you wish to start trading by picking up where you left off in a previous sequence, then use one of the attached market long/short scripts. Drag the script onto the chart and select your initial lot size. Once the trade opens, drag the robot onto the chart and it will pick up as though it has sent the open trade.
Semi-automating the initial trade direction
Over in the DIBS thread. Peter Crowns states that the trading bias for the day can be taken from the open price of the day. If the market is above this price the bias is long; below is short. The bot creates a line on your chart that the robot will consult before sending the initial trade in the sequence. Once the line is on the chart, adjust it to represent whatever is the price of your choice. PC states that the daily start should be 6.00 GMT for those of us trading the European and NY markets, so I am using this as the start of my day. You can use any opening price you want.
Turn AutoCalculateTradeDirection to true to use this feature.
Allowing only one successful trade per session
To stop the robot immediately taking another trade after one has hit its tp, set StopTradingAfterTpHit to true. The bot should send no further trades until you re-drag it onto the chart, or the next tsazb- session opens.
Pivot
mystic asked me to add a daily pivot so the bot can trade off this.
The inputs are:
- UsePivot: turn this feature on. If this is turned off, then the yellow line is draws at Bid - 20 pips and you can adjust/ignore it to suit yourselves.
- PivotTimeFrame: set this in minutes - the default is D1. This allows you to use a different tf pivot to the chart you are using for trading.
- CriminalHasSundayCandle: set this to true if using the D1 pivot and your crim has a Sunday candle. It forces the bot to use the hi-lo of Friday, not Sunday night.