FXCM Forex Trading

Two Moving Average Cross Expert Advisor

Custom MT4 expert advisors published here.

Moderator: admin

Two Moving Average Cross Expert Advisor

Postby Apprentice » Sat Mar 04, 2017 7:32 am

Expert Advisor Entry Rules:
- Go Long when Fast MA crosses above the Slow MA
- Go Short when Fast MA crosses below the Slow MA

Where:
- MA can be any of 17 different Moving Averaging methods
- Price Type, MA Method and MA Period for each MA can be changed

Notes:
- Two_MA_Cross_Indicator.mq4 required (installed in the Indicators folder)

EA Features:
- Distance of Price with Slow MA to approve Entry (if too far away, trade is not executed)
- More than 1 trade can be opened at once
- Minutes to Wait for Next Open Trade
- Stop Loss, Take Profit and Trailing Stop Loss options
- AutoLots or Manual
- Trade Both Sides or only one direction
- Comments Displayed on Screen
- Optional Email and Sound Alerts

For further development (if requested):
- Lookback feature: check the crossing event looking back at n number of bars - For this, only the default MT4 moving averages could be used.
Two_MA_Cross_Indicator.mq4
(24.06 KiB) Downloaded 267 times

Two_MA_Cross_EA.mq4
(64.82 KiB) Downloaded 270 times
User avatar
Apprentice
FXCodeBase: Confirmed User
 
Posts: 17175
Joined: Thu Dec 31, 2009 11:59 am
Location: Zagreb, Croatia

Re: Two Moving Average Cross Expert Advisor

Postby Ehab.Ali » Sat Mar 04, 2017 9:12 am

thanks Apprentice
Last edited by Ehab.Ali on Sun Mar 05, 2017 10:57 am, edited 1 time in total.
Ehab.Ali
 
Posts: 36
Joined: Tue May 31, 2016 2:10 pm

Re: Two Moving Average Cross Expert Advisor

Postby Ehab.Ali » Sat Mar 04, 2017 6:20 pm

i found a problem while testing it

trailing stop working with buy orders only not working with sell
can you pls fix it
Ehab.Ali
 
Posts: 36
Joined: Tue May 31, 2016 2:10 pm

Re: Two Moving Average Cross Expert Advisor

Postby Apprentice » Mon Mar 06, 2017 5:02 am

Fixed.
User avatar
Apprentice
FXCodeBase: Confirmed User
 
Posts: 17175
Joined: Thu Dec 31, 2009 11:59 am
Location: Zagreb, Croatia

Re: Two Moving Average Cross Expert Advisor

Postby Ehab.Ali » Mon Mar 06, 2017 7:22 am

Apprentice wrote:Fixed.


still not working with sell orders
Ehab.Ali
 
Posts: 36
Joined: Tue May 31, 2016 2:10 pm

Re: Two Moving Average Cross Expert Advisor

Postby Apprentice » Thu Mar 16, 2017 4:45 am

Update.
User avatar
Apprentice
FXCodeBase: Confirmed User
 
Posts: 17175
Joined: Thu Dec 31, 2009 11:59 am
Location: Zagreb, Croatia

Re: Two Moving Average Cross Expert Advisor

Postby Apprentice » Tue Mar 21, 2017 4:23 am

This is a major update to the following Expert Advisors:

- Multi Indicator EA
- Two MA Cross EA
- MA Cross with Exit EA

The following improvements have been made:

- Now the trader sets the number of pips rather than points (no more thinking about how many points to set, simply write 20 for 20 pips and that's it).
- EA can be activated/deactivated to trade or not
- Auto Lots calculation has been revised and is working properly
- Comments displayed on chart give more information about risk, lots, equity, opened orders
- (By the way, trades comments can be turned off to avoid the comments area to keep growing)

Additions:

The trader can now estipulate a maximum percentage of risk for open trades. For example the risk can be 2% per trade and the maximum 7% of the equity. The user can also choose the number of opened trades at the same time, for example 5.

So the way it works is that once the SL has moved to breakeven, then the risk for that trade is no longer considered in the equity providing additional room for opening further trades if necessary. It could be, for instance, that there were 3 opened trades but the 4th one was opened when one of the prior 3 moved to B/E.

Also, the trader could decide to have the same fixed lots every time and again set a maximum number of lots traded. For example 1 lot per trade and a maximum of 4 lots in total.

One note about the trailing stop

The way the Stop Loss works is to initially protect the trade, say with 20 pips. If the user additionally sets a trailing stop (TSL) of 15 pips with a 5 pips step, it will not work until the trade is in profit. This means they are two different concepts. The TSL will be activated when the trade is 15 pips in the green and then correct itself every 5 pips (step).
User avatar
Apprentice
FXCodeBase: Confirmed User
 
Posts: 17175
Joined: Thu Dec 31, 2009 11:59 am
Location: Zagreb, Croatia

Re: Two Moving Average Cross Expert Advisor

Postby 7510109079 » Fri Mar 24, 2017 1:59 pm

Does the two MA Cross indicator exist as a Marketscope lua indicator?
7510109079
FXCodeBase: Graduate
 
Posts: 342
Joined: Wed May 18, 2011 7:23 am

Re: Two Moving Average Cross Expert Advisor

Postby Apprentice » Sat Mar 25, 2017 7:07 am

User avatar
Apprentice
FXCodeBase: Confirmed User
 
Posts: 17175
Joined: Thu Dec 31, 2009 11:59 am
Location: Zagreb, Croatia

Re: Two Moving Average Cross Expert Advisor

Postby 7510109079 » Mon Mar 27, 2017 8:36 am

thats good thx but doesnt have the same ability to specify the OPEN or CLOSE as the mq4 does.

Any possibility of putting together something like this:
Image
7510109079
FXCodeBase: Graduate
 
Posts: 342
Joined: Wed May 18, 2011 7:23 am

Next

Return to MT4 Expert Advisors

Who is online

Users browsing this forum: Google [Bot] and 2 guests