Universal MA Cross EA - page 66

 

MinCrossDistance is assumed to be in points not pips (distance that is compared to minimal distance is calculated internally in points, hence the MinCrossDistance must be in points too). On a 5 digit broker (as yours, judging from the picture) you have to multiply it with 10 to get values in pips

suckerpunch:
On backtest I don't know why the EA is buying right here, the distance between both MA's is around 20 pips, however what I have entered is 45. Can anyone explain?
 

Cool thanks for your help.

Got it to work on backtest on several brokers platforms.

However, I can't get it to execute any trades on MT4 demo.

 

Universal Moving Average

I was looking for a great ea exactly with the strategy you have built this one at, Great job, thanks for sharing it.

 

ma cross problem

Hello Everybody,

Please look at the attached screen. Could anybody explain why EA opened these trades without crosses? It seems misterious to me

Timeframe h1

fastMA 13 simple, close

slow MA 40 simple, close

stoploss 40

trailing stop 40 type1

mincrossdistance 2

exitoncross true

confirm on entry true

slippage 5

min price distance 5

Thanks a lot.

FiXy

Files:
1_1.gif  16 kb
 

Hi, the EA works fantastically on backtests, however I can't get it to execute a trade on demo. I have everything activated.

2011.06.08 15:54:24 universalMACrossEA EURUSD,H1: 19:00 - 0 - 255 - 10 - DOWN

2011.06.08 15:54:23 universalMACrossEA EURUSD,H1: MinCrosDistance SELL

All I get are messages like that over and over, the last message seems to be like it is telling the platform to take a sell order because the minimum cross distance has been reached, yet it doesn't.

The exact same settings work on the backtest.

 

Now I'm getting this:

2011.06.08 16:17:11 universalMACrossEA EURUSD,M1: Error opening BUY order : (0) no error

Grr, I've spent so much time backtesting I just want to forward test. Why are EA's so hard ;/

 

Close position at price cross over

I love this EA. Is it possible to add the feature of buy/sell when price crosses one MA and closing the position when price crosses another MA? Preferably I'd like it to open/close a position only after the brice bar has closed, confirming a truecross over. Is it already in there and I can't get it to work that way? Is ther another EA that does this that has the shift feature? Thanks in advance.

 

So I've been doing quite a bit of backtesting and forward testing ( Demo ).

And it seems Third MA does not work properly.

If it buys above, it buys on ANY cross.

Vice versa for sell.

Kind of defeats the purpose unless I am missing a variable in the settings.

Help would be appreciated, everything else seems to be working fine.

 
firedave:
I try to make an EA for any Moving Average Cross strategy, try to make it universal. So please let me know should you have any suggestion to add to this EA.

Common Setting :

-----------------

StopLoss (default 100)

Set your Stop Loss. Use 0 (zero) if you don't like to use Stop Loss ( not recommended ).

TakeProfit (default 200)

Set your Take Profit. Use 0 (zero) if you like to use open target.

Trailing Stop Setting :

----------------------

ver.6 TrailingStopType (default 1)

Set trailing stop type. 1:will start trailing if profit in pips is greater / same with TrailingStop. 2:will start trailing as soon as trade in profit. (will add other type of trailing stop if suggested, latest suggestion is SafeZone trailing stop post #99

TrailingStop (default 40)

Set the Trailing Stop. Use 0 (zero) if you don't use trailing stop feature.

Moving Average Setting :

------------------------

FastMAPeriod (default 10)

Fast Moving Average Period.

FastMAType (default EMA / 1)

Fast Moving Average Type 0:SMA 1:EMA 2:SMMA 3:LWMA

FastMAPrice (default Close / 0)

Fast Moving Average Applied Price 0:Close 1:Open 2:High 3:Low 4:Median 5:Typical 6:Weighted

ver.7.2 FastMAshift (default 0)

Fast Moving Average Shift

SlowMAPeriod (default 80)

Slow Moving Average Period.

SlowMAType (default EMA / 1)

Slow Moving Average Type 0:SMA 1:EMA 2:SMMA 3:LWMA

SlowMAPrice (default Close / 0)

Slow Moving Average Applied Price 0:Close 1:Open 2:High 3:Low 4:Median 5:Typical 6:Weighted

ver.7.2 FastMAshift (default 0)

Slow Moving Average Shift

Minimum Cross Distance :

------------------------

ver.2 MinCrossDistance (default 0)

Set the pip distance between FastMA and SlowMA to be consider as a valid cross. Use 0 (zero) to disable this filter.

ver.7 MaxLookUp (default 1)

Set number of bar after the cross to keep checking on the entry condition in regards with the minimum distance between FastMA and SlowMA. Need MinCrosDistance > 0 to enable this feature. Use 0 (zero) to disable this feature.

Exit Setting :

-------------

StopAndReverse (default true)

If set to TRUE, will exit any trade and reverse position when signal change.

PureSAR (default false)

If set to TRUE, will use no Stop Loss - Take Profit - and Trailing Stop. This is always in play setting.

ver.7.2 ExitOnCross (default false)

If set to TRUE, will exit any trade if there is an opposite cross without consider any additional filter. So exit purely base on moving average cross.

Third MA Setting :

------------------

ver.5 UseThirdMA (default false)

If set to TRUE (and UseCounterTrend = FALSE), will only trade according to ThirdMA direction, above for BUY and below for SELL.

ver.5 UseCounterTrend (default false)

If set to TRUE will keep trade even if counter ThirdMA direction, but with different StopLoss and TakeProfit. Need UseThirdMA = TRUE to enable this feature.

ver.7 OnlyCounterTrend (default false)

If set to TRUE will set the EA only to trade counter trend trade, mean BUY if cross below ThirdMA and SELL if cross above ThirdMA. Need UseCounterTrend = TRUE to enable this feature.

ver.5 ThirdMAPeriod (defaul 100)

Third Moving Average Period.

ver.5 ThirdMAType (default EMA / 1)

Third Moving Average Type 0:SMA 1:EMA 2:SMMA 3:LWMA

ver.5 ThirdMAPrice (default Close / 0)

Third Moving Average Applied Price 0:Close 1:Open 2:High 3:Low 4:Median 5:Typical 6:Weighted

ver.7.2 ThridMAshift (default 0)

Third Moving Average Shift

ver.5 CTStopLoss (default 0)

Set your Stop Loss for CounterTrend trade. Use 0 (zero) if you don't like to use Stop Loss ( not recommended ).

ver.5 CTTakeProfit (default 0)

Set your Take Profit for CounterTrend trade. Use 0 (zero) if you like to use open target.

Pivot Filter Setting :

-------------------

ver.8.0 Use.Pivot.Filter (default false)

Set to true if you like to filter the trade, only BUY if the cross of Slow and Fast MA occur between S1 and S2 and only SELL if the cross of Slow and Fast MA occur between R1 and R2.

Order Setting :

--------------

ReverseCondition (default false)

Set TRUE to reverse the entry condition.

ver.3 ConfirmedOnEntry (default true)

If set to TRUE, will enter/exit trade on the next bar after the cross confirmed. If set to FALSE, will enter/exit trade as soon as there is a cross.

ver.4 OneEntryPerBar (default true)

If set to TRUE, will only trade once on one bar. If set to FALSE, will trade more than once on one bar if the entry condition is still valid, although still one trade at a time.

NumberOfTries (default 5)

Number of try if the order rejected by the system.

Slippage (default 5)

Slippage setting.

MagicNumber (default 1234)

Use to generate Magic Number. Change this number ONLY if you like to run the EA on same pair and same time frame but with different setting.

Multiple Open Trade Setting :

-----------------------------

ver.5 MaxOpenTrade (default 2)

Number of maximum open trade at one time. This setting is use when StopAndReverse / PureSAR = FALSE so the EA won't close the open order when there is an opposite signal, but rather it will open a new trade. Set the number of open trade allowed. If StopAndReverse / PureSAR = TRUE this setting will always = 1, mean one trade at a time.

ver.6 MinPriceDistance (default 5)

If multiple open trade enable (by set MaxOpenOrder>1 and OneEntryPerBar=FALSE) this number will determine the minimum distance between each trade on same direction.

Time Filter Setting :

-------------------

UseHourTrade (default false)

If set to TRUE, the EA only active on certain time.

StartHour (default 10)

Time when the EA start active (use with UseHourTrade = TRUE).

EndHour (default 11)

Time when the EA stop active (use with UseHourTrade = TRUE).

Lot and Money Management Setting :

------------------------------------

Lots (default 1)

Number of lot per trade.

MM (default false)

If set to TRUE, will use build in money management.

AccountIsMicro (default false)

If using Micro Account set this to TRUE.

Risk (default 10)

Use with MM = TRUE to set the risk per trade.

Cross Alert Setting :

--------------------

ver.5 EnableAlert (default true)

Will sound an alert when there is a moving average cross, cross UP or cross DOWN.

ver.5 SoundFilename (default "alert.wav")

The filename for the alert.

BackTest Setting :

------------------

PrintControl (default true)

Print some comment on backtesting.

Show_Settings (default true)

Show setting on the chart.

Let me know if you still got problem with the setting. Thank you to codersguru and pengie for several partial code. Hope this help

Journal :

-----------

version.6 :

- fixed ConfirmedOnEntry bug.

- add immediate trailing stop.

- add MinPriceDistance for multiple open trade.

version.7 :

- add MaxLookUp feature to keep checking on the entry after certain bar from the cross regarding the MinCrossDistance.

- add OnlyCounterTrend feature if using ThirdMA filter.

version.7.1 :

- fixed MinCrossDistance bug.

version.7.2 :

- fixed MinCrossDistance bug for ConfirmedOnEntry = FALSE.

- add MA shift parameter.

- add ExitOnCross feature.

version.7.3 :

- fixed on screen display COMMENT.

version.8.0 :

- added Pivot Filter.

version.8.1 :

- revised some code because Build 206 bugs.

With this ea can someone help me get ride of the timeframe setting and the minuimum distance between the ma's to enter trades? it's set to 5 right now! please and thank you.

 

Hi there, I have been trading and backtesting with moving averages a lot, and my experience is that certain settings will work for a short period. But, when you backtest it from let's say 1999 to 2011, the results are nog very exiting. I came across multiple MA settings on this thread, but each of 'em won't last on the long run I think.

That's when I decided to use one very large average and one very, very small average. This way, we can make the best use of long, strong trends which will give us big profits. However, when price is ranging, we will make lots of small losses.

By using EMA 1 and EMA 1000, no TP or SL, just close trades by stop and reverse, this strategy would have returned a small 37.000 euros with only 0.5 lots and a initial balance of 2.000!

Why would you look for a strategy that's profitable for a couple of months? Look for one that gives you a big return over multiple years!

We risk 500, make a profit of 37.000 euros in 138 months, that's an average of 270 euros or 54 percent per month.

I'm only 20 years old, so there's no rush for me. I don't care if I have 4 consecutive months of losses in a row, because I know price is ranging. When it turns into a trend, the profit will make up all the losses of the previous months and even more.

As you can see in the attached strategy report, 90 percent of the total trades are losses. I don't like this, but with the current options of the EA there's nothing I can do about it. However, if someone manages to make the breakeven option work properly, this system could even be more profitable. When the EMA 1 crosses the EMA 1000, a position is taken and it usually moves into the right direction straight away. When we have a profit of x pips, say 20 pips, I would want the EA to set a breakeven point or lock-in x profits. This protects us from turning a profit into a loss.

This way, the number of losing trades will be way smaller.

I tried the universal MA cross 1.3.1, but couldn't get the breakeven option to work properly. Please, could someone update this wonderful EA with the described breakeven options? I would be very, very grateful..

Thanks in advance,

Hessel

Reason: