Universal MA Cross EA - page 50

 
rickyc2511:
Hi Sn,

Thanks mate -I will load it up and see how it goes.

The "distance" thing you are talking about, is ,I believe, the "minimum cross distance"-which is the min distance in pips between the MA's before it confirms a trade entry.

kind regards

rickyc

Okay, I ran it in back test and demo today and didn't get the error. I looked at the code and it looks like there is a failure of some kind that the program tries to print out but the error value is no longer available. I have added 2 debugging lines and changed a few lines that calculate the stop loss to have the correct digits.

So give it a shot and if the debug line shows up capture as much of the info in the Journal and the Experts tab as you can related to the buy/sell.

Also, the set file you sent - was it for AUDUSD - 1H? The short back test didn't work to well so I'm gonna try some more tests.

Cross your fingers - we might get rich yet.

sn

 

Hi mate,

Thanks for your input and help, I haven't been able to get it to run on my live Go Markets acct, yet it works on alpari demo acct?

(this is the "5digit" version you posted in your first reply to my question.

I am going to try and run your new version with the debug lines, and I will let you know how it goes.

The only thing dodgy message I'm getting from metatrader is in the journal ,and I'm getting lots of "old tick" messages, usually in clusters, every few hours-perhaps this is hindering the ea-although i have tried setting it to open as 'confirmed on entry-true" which means it shouldn't be checking every tick for a trade condition anyway?

That set file was the aus/usd, but I loaded it for the sake of trying to get the thing working.

Kind regards

rickyc

 

[Request] - Different SMA Cross EA

Hi all,

I'm newbie here.

I looking for an EA which can Enter and Close at Different SMA Cross. Purely MA cross.

Example:

SMA use : SMA 62, SMA 100, SMA 200

Time Frame : M1

Entry :

SMA 200 cross SMA SMA 100

SL : 20 pips

Exit :

(i) SMA 62 cross SMA 100 [FAST]

(ii) SMA 100 & SMA 200 [ SLOW ]

Note : Exit (i) or Exit (ii), whichever first

Note : 20pips safety margin before Exit (i) is executed.

Hope any master trader here can help. Thanks.

 
serpentsnoir:
Okay, I ran it in back test and demo today and didn't get the error. I looked at the code and it looks like there is a failure of some kind that the program tries to print out but the error value is no longer available. I have added 2 debugging lines and changed a few lines that calculate the stop loss to have the correct digits.

So give it a shot and if the debug line shows up capture as much of the info in the Journal and the Experts tab as you can related to the buy/sell.

Also, the set file you sent - was it for AUDUSD - 1H? The short back test didn't work to well so I'm gonna try some more tests.

Cross your fingers - we might get rich yet.

sn

Hi mate,

Well, I still get this thing to trade...keep getting the same error.

There was no debug alert. Not sure what is happening.

Here is the log entry:

22:55:06 universalMACrossEA GBPJPY,H1 inputs: Expert_Name="---------- Universal MA Cross EA v8.1"; MagicNumber=1234; StopLoss=750; TakeProfit=1500; TrailingStop_Setting="---------- Trailing Stop Setting"; TrailingStopType=0; TrailingStop=0; Indicator_Setting="---------- Indicator Setting"; FastMAPeriod=3; FastMAType=1; FastMAPrice=0; FastMAshift=0; SlowMAPeriod=55; SlowMAType=1; SlowMAPrice=0; SlowMAshift=0; CossDistance_Setting="---------- Min Cross Distance Setting"; MinCrossDistance=3; MaxLookUp=3; Exit_Setting="---------- Exit Setting"; StopAndReverse=true; PureSAR=false; ExitOnCross=false; ThirdEMA_Setting="---------- Third MA Setting"; UseThirdMA=false; UseCounterTrend=false; OnlyCounterTrend=false; ThirdMAPeriod=100; ThirdMAType=1; ThirdMAPrice=0; ThirdMAshift=0; CTStopLoss=0; CTTakeProfit=0; Pivot.Setting="---------- Pivot Filter Setting"; Use.Pivot.Filter=false; Order_Setting="---------- Order Setting"; ReverseCondition=false; ConfirmedOnEntry=true; OneEntryPerBar=true; NumberOfTries=10; Slippage=5;

22:55:06 universalMACrossEA GBPJPY,H1: Last Trade : None

22:55:06 universalMACrossEA GBPJPY,H1: initialized

22:55:40 universalMACrossEA GBPJPY,H1: Prev : DOWN - Curr : DOWN

22:55:40 universalMACrossEA GBPJPY,H1: Alert: Moving Average Cross DOWN !

22:55:40 universalMACrossEA GBPJPY,H1: 10:25 - 1 - 288 - 3 - DOWN

22:55:40 universalMACrossEA GBPJPY,H1: MinCrosDistance SELL

22:55:40 universalMACrossEA GBPJPY,H1: Error opening SELL order : (0) no error

Does anyone know what causes this "error-no error" entry that stops the ea from opening an order?

Everything else seems to be set ok.

kind

regards

rickyc

 

UnivMACross - Logs With Debug Statements

rickyc2511:
Hi mate,

Well, I still get this thing to trade...keep getting the same error.

There was no debug alert. Not sure what is happening.

22:55:40 universalMACrossEA GBPJPY,H1: Alert: Moving Average Cross DOWN !

22:55:40 universalMACrossEA GBPJPY,H1: 10:25 - 1 - 288 - 3 - DOWN

22:55:40 universalMACrossEA GBPJPY,H1: MinCrosDistance SELL

22:55:40 universalMACrossEA GBPJPY,H1: Error opening SELL order : (0) no error

Does anyone know what causes this "error-no error" entry that stops the ea from opening an order? Everything else seems to be set ok.

kind regards -rickyc

Hi Ricky,

I tested the EA on GbpJpy H1 using your settings and did get the same error message you got, but I also got debug statements with the error messages.

Also, the EA was trading fine before....and after...the error messages.

The first log (Log 1) shows the debug statements seem to repeat 10x's...twice...and then the log shows more trades (Buys and Sells) after the error messages. The error messages did not stop this EA from making more trades afterwards. You can see the SELL trades following the error messages. (Log 1)

I don't know why it got the errors when the rest of the trades appear ok??

Just a suggestion - keep your test period short - 2 weeks - easier to view the logs. I used 1/1/2010 - 1/15/2010 GbpJpy H1.

I then ran the same settings except I disabled MinCrossDistance=0 and MaxLookUp=0...and got some debug statements...but no error messages. and the trades seem to recover (not cycle debug through 10x's) and it did not have the same price problems as in Log 1. It also continued to trade after the debug statement. See the log excerpt below(Log 2).

Looks like some code problem sending the correct price when MinCrossDistance>0 and MaxLookUp>0...?

Hope the debug statements helps you (and others) try to track this down and fix this neat little EA.

Good luck! Robert

Log 1- Settings WITH MinCrossDistance and MaxLookUp

2010.01.07 08:00 universalMACrossEA[5 Dig]-V2 GBPJPY,H1: invalid price 147.25800000 for OrderSend function

2010.01.07 08:00 universalMACrossEA[5 Dig]-V2 GBPJPY,H1: OrderSend error 4107

2010.01.07 08:00 universalMACrossEA[5 Dig]-V2 GBPJPY,H1: sn Debug on sell: ticket,err,count -1/4107/7

2010.01.07 08:00 universalMACrossEA[5 Dig]-V2 GBPJPY,H1: invalid price 147.25800000 for OrderSend function

2010.01.07 08:00 universalMACrossEA[5 Dig]-V2 GBPJPY,H1: OrderSend error 4107

2010.01.07 08:00 universalMACrossEA[5 Dig]-V2 GBPJPY,H1: sn Debug on sell: ticket,err,count -1/4107/8

2010.01.07 08:00 universalMACrossEA[5 Dig]-V2 GBPJPY,H1: invalid price 147.25800000 for OrderSend function

2010.01.07 08:00 universalMACrossEA[5 Dig]-V2 GBPJPY,H1: OrderSend error 4107

2010.01.07 08:00 universalMACrossEA[5 Dig]-V2 GBPJPY,H1: sn Debug on sell: ticket,err,count -1/4107/9

2010.01.07 08:00 universalMACrossEA[5 Dig]-V2 GBPJPY,H1: Error opening SELL order : (0) no error

2010.01.07 08:00 universalMACrossEA[5 Dig]-V2 GBPJPY,H1: Prev : DOWN - Curr : DOWN

2010.01.07 08:00 universalMACrossEA[5 Dig]-V2 GBPJPY,H1: 05:00 - 3 - 32 - 3 - DOWN

2010.01.07 08:00 universalMACrossEA[5 Dig]-V2 GBPJPY,H1: MinCrosDistance SELL

2010.01.07 08:00 universalMACrossEA[5 Dig]-V2 GBPJPY,H1: Prev : DOWN - Curr : DOWN

2010.01.07 08:00 universalMACrossEA[5 Dig]-V2 GBPJPY,H1: 05:00 - 3 - 33 - 3 - DOWN

2010.01.07 08:00 universalMACrossEA[5 Dig]-V2 GBPJPY,H1: MinCrosDistance SELL

2010.01.07 08:00 universalMACrossEA[5 Dig]-V2 GBPJPY,H1: Prev : DOWN - Curr : DOWN

2010.01.07 08:00 universalMACrossEA[5 Dig]-V2 GBPJPY,H1: 05:00 - 3 - 33 - 3 - DOWN

2010.01.07 08:00 universalMACrossEA[5 Dig]-V2 GBPJPY,H1: MinCrosDistance SELL

Log 2 - Settings WITHOUT MinCrossDistance and MaxLookUp

11:04:55 2010.01.14 19:00 universalMACrossEA[5 Dig]-V2 GBPJPY,H1: Prev : DOWN - Curr : DOWN

11:04:55 2010.01.14 19:00 universalMACrossEA[5 Dig]-V2 GBPJPY,H1: Prev : DOWN - Curr : DOWN

11:04:55 2010.01.14 19:00 universalMACrossEA[5 Dig]-V2 GBPJPY,H1: Prev : DOWN - Curr : UP

11:04:55 2010.01.14 19:00 universalMACrossEA[5 Dig]-V2 GBPJPY,H1: MA Cross BUY

11:04:55 2010.01.14 19:00 universalMACrossEA[5 Dig]-V2 GBPJPY,H1: open #18 buy 1.00 GBPJPY at 148.73 sl: 141.23 tp: 163.73 ok

11:04:55 2010.01.14 19:00 universalMACrossEA[5 Dig]-V2 GBPJPY,H1: sn Debug on buy: ticket,err,count 18/0/0

11:04:55 2010.01.14 19:00 universalMACrossEA[5 Dig]-V2 GBPJPY,H1: BUY order opened : 148.73

11:04:55 2010.01.14 19:00 universalMACrossEA[5 Dig]-V2 GBPJPY,H1: Prev : UP - Curr : DOWN

11:04:55 2010.01.14 19:00 universalMACrossEA[5 Dig]-V2 GBPJPY,H1: MA Cross SELL

11:04:55 2010.01.14 19:00 universalMACrossEA[5 Dig]-V2 GBPJPY,H1: close #18 buy 1.00 GBPJPY at 148.73 sl: 141.23 tp: 163.73 at price 148.63

11:04:55 2010.01.14 19:00 universalMACrossEA[5 Dig]-V2 GBPJPY,H1: STOP AND REVERSE !

11:04:55 2010.01.14 19:00 universalMACrossEA[5 Dig]-V2 GBPJPY,H1: Prev : DOWN - Curr : UP

11:04:55 2010.01.14 19:00 universalMACrossEA[5 Dig]-V2 GBPJPY,H1: MA Cross BUY

11:04:55 2010.01.14 19:01 universalMACrossEA[5 Dig]-V2 GBPJPY,H1: Prev : UP - Curr : UP

11:04:55 2010.01.14 19:01 universalMACrossEA[5 Dig]-V2 GBPJPY,H1: Prev : UP - Curr : UP

 

Hi Robert,

Thanks for that reply to my post/questions about errors.

I appreciate the time and work it takes helping those who don't know about code to be able to clearly identify a problem-like me!

I really would like this ea to trade,as I can see huge potential in it,given some optimisation over different pairs and MA periods.

I am using n MA crossover period of 55/3 on a 1hr chart and it works well-so naturaly I want to use this ea to automate it.

I will change the min cross distance and max lookup settings and see whther it places a trade for me.It hasn't actually even tried to place a trade forme so far,which is strange.I would feel better if there was at least an error code stating the failure of an attemtped trade.There is no problem in margin or acct related issue that may stop it trading,so it must be the code/settings.

Anyway, I will take your results and note your suggestions and try again.

Just for a note, my broker is GoMarkets in australia.Perhaps anyone else here might be trading this ea with them?

I will try again and post back after a few more attempts.

Kind regards

rickyc

 
cosmiclifeform:
Hi Ricky,

...I then ran the same settings except I disabled MinCrossDistance=0 and MaxLookUp=0...and got some debug statements...but no error messages. and the trades seem to recover (not cycle debug through 10x's) and it did...

Hi Robert,

When you said you disabled the min cross distance setting and the max look-up setting did you mean you just set them to "0"?

I can't see an option to turn them "on" or "off"-only an input field for a value.

Thanks

rickyc

 

Universal MA Cross EA with profit levels

I am a new trader, am inquiring if there is some one who can add take profit levels to the Universal MA Cross EA. When am trading i prefer to exit half of my profits at 50 and let the other half run up to the next Fibonacci level. The Universal MA Cross EA works well for me but I have failed to set it to exit half of my trades and let the rest run. can any one help me?

Files:
 
rickyc2511:
Hi Robert,

When you said you disabled the min cross distance setting and the max look-up setting did you mean you just set them to "0"?

I can't see an option to turn them "on" or "off"-only an input field for a value.

Thanks

rickyc

Hi Ricky,

Yes - disable = off = 0 - set MinCrossDistance =0 and MaxLookUP = 0 and you don't get the 4107 debug errors.

However, those features (MCD and MLU) appear to work fine as they are designed, because I've used them in other tests and they seem to do what they are designed to do. The settings work consistently. You can run a short test and quickly compare them - see screen views attached of with/without MCD and MLU. I've used MCD=10 and MLU=1 with good results...less trades but safer crossings. MLU>1 trades x bars later after crossing...way too late for me.

How MCD and MLU are related to the error logs below, I'm not sure what they mean or how to fix them. Hopefully the debug statements will lead us in the right direction.

Test Log1 - MCD=0 and MLU=0

No MinCrossDistance BUY or SELL mentioned in logs

Has debug error all at trades.

Looks like it's reporting errors0 and count0, indicating trade is ok and no errors?

It was a good trade in any case.

universalMACrossEA[5 Dig]-V2 EURUSD,H1: MA Cross BUY

universalMACrossEA[5 Dig]-V2 EURUSD,H1: open #2 buy 1.00 EURUSD at 1.4556 tp: 1.4561 ok

universalMACrossEA[5 Dig]-V2 EURUSD,H1:sn Debug on buy: ticket,err,count 2/0/0

universalMACrossEA[5 Dig]-V2 EURUSD,H1: BUY order opened : 1.4556

universalMACrossEA[5 Dig]-V2 EURUSD,H1: Prev : UP - Curr : DOWN

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

Test Log2 - MCD=10 and MLU=1

Has MinCrossDistance BUY and SELL

Has 2 debug errors

Debugs at good trades as above and other debugs for an "invalid price" 4107 error

MCD SELL - A Good Trade - 2009.12.03 17:00

universalMACrossEA[5 Dig]-V2-Test EURUSD,H1: 16:00 - 1 - 10 - 10 - DOWN

universalMACrossEA[5 Dig]-V2-Test EURUSD,H1: MinCrosDistance SELL

universalMACrossEA[5 Dig]-V2-Test EURUSD,H1: open #4 sell 1.00 EURUSD at 1.5070 tp: 1.5065 ok

universalMACrossEA[5 Dig]-V2-Test EURUSD,H1: sn Debug on sell: ticket,err,count 4/0/0

universalMACrossEA[5 Dig]-V2-Test EURUSD,H1: SELL order opened : 1.507

universalMACrossEA[5 Dig]-V2-Test EURUSD,H1: Prev : DOWN - Curr : DOWN

Another MCD SELL - "Invalid Price" - 2009.12.03 23:00

universalMACrossEA[5 Dig]-V2-Test EURUSD,H1: 22:00 - 1 - 10 - 10 - DOWN

universalMACrossEA[5 Dig]-V2-Test EURUSD,H1: MinCrosDistance SELL

universalMACrossEA[5 Dig]-V2-Test EURUSD,H1: invalid price 1.50732000 for OrderSend function

universalMACrossEA[5 Dig]-V2-Test EURUSD,H1: OrderSend error 4107

universalMACrossEA[5 Dig]-V2-Test EURUSD,H1: sn Debug on sell: ticket,err,count -1/4107/0

** Cycles through 2 loops x10 tries per loop - same 4107 error message

As the error message indicates, it seems to be an "invalid price" being sent.

I've added a few on-screen comments to help debug the invalid price challenge.

My results show an 8 digit price, the same as the error message shows above. I don't know enough on how to fix the digits problems, or as to why MODE_DIGITS is different than Digits, but it is related to price and maybe someone does.

Add them in your sComments section and recompile, then test to see the values on the screen.

sComment = sComment + sp;

sComment = sComment + "Ask+pointvalue*TrailingStop=" + (NormalizeDouble(Ask+pointvalue*TrailingStop,Digits)) + NL;

sComment = sComment + "Digits= " + Digits + " Point= " + Point + " PointValue= " + pointvalue + NL;

sComment = sComment + "MODE_DIGITS= " + MODE_DIGITS + " | ";

sComment = sComment + "MODE_ASK= " + MODE_ASK + " | ";

sComment = sComment + "MODE_BID= " + MODE_BID + NL;

sComment = sComment + "NormalizeDouble(MarketInfo(Symbol(),MODE_ASK),Digits)= "+Symbol() + " "+NormalizeDouble(MarketInfo(Symbol(),MODE_ASK),Digits) + NL;

sComment = sComment + sp;

Others can add other comments and suggestions to help debug this further as well.

Hopefully this all helps you and others with better coding skills than I who can take a look and solve the challenge with us for this nifty little EA.

Take care...and good luck!

Robert

 

For this you can use the Multipurpose trademanager ea.