Jump to content

Megadroid Pro (links first post)


Recommended Posts

Could be a bug in Megadroid Pro

 

Hi brothers and sisters,

 

While running forward test, I suspect there is this small bug in the recovery subroutine.

 

int RecoverTrades() {

int l_count_0 = 0;

for (int l_pos_4 = OrdersHistoryTotal() - 1; l_pos_4 >= 0; l_pos_4--) {

if (OrderSelect(l_pos_4, SELECT_BY_POS, MODE_HISTORY)) {

if (OrderMagicNumber() != S1_Reference && OrderMagicNumber() != S2_Reference) continue;

if (OrderSymbol() != Symbol()) continue; // this is to be inserted to ensure recovery on the same symbol

CountBalance(OrderProfit());

l_count_0++;

}

}

return (l_count_0);

}

 

The recovery routine only check for the 2 magic numbers, but does not include any symbols. If you are using different magic numbers in each symbol pair, then this is fine. But if you uses the same magic number (or the default number that comes with it) throughout all your different symbol pairs, the outcome could be undesirable.

 

Eg:

EURUSD uses magic number 111, 112, USDCHF uses 211, 212, and EURCHF uses 311, 312, then the original Megadroid Pro recovery routine works fine.

 

EURUSD, USDCHF and EURCHF all uses magic number 111 and 112, then the above routine will not be able to differentiate between each of the symbol pair.

 

A simple way to solve this problem is to include this statement (shown above in the route as well):

 

if (OrderSymbol() != Symbol()) continue;

 

This should overcome the issue mention above.

 

Hope this helps.

 

Regards,

Collin

Link to comment
Share on other sites

  • Replies 2.1k
  • Created
  • Last Reply

Top Posters In This Topic

Re: Megadroid Pro

 

I use this code to solve the problem in all my EAs

(replace S1_reference with magic or Magic witch name is use in the EA)

(replace 100 with 101, 102 ... for each ea

 

if (StringSubstr(Symbol(), 0, 6) == "AUDCAD") { S1_Reference = 100001 ; S2_Reference = 100101 ; }

if (StringSubstr(Symbol(), 0, 6) == "AUDJPY") { S1_Reference = 100002 ; S2_Reference = 100102 ; }

if (StringSubstr(Symbol(), 0, 6) == "AUDNZD") { S1_Reference = 100003 ; S2_Reference = 100103 ; }

if (StringSubstr(Symbol(), 0, 6) == "AUDUSD") { S1_Reference = 100004 ; S2_Reference = 100104 ; }

if (StringSubstr(Symbol(), 0, 6) == "CHFJPY") { S1_Reference = 100005 ; S2_Reference = 100105 ; }

if (StringSubstr(Symbol(), 0, 6) == "EURAUD") { S1_Reference = 100006 ; S2_Reference = 100106 ; }

if (StringSubstr(Symbol(), 0, 6) == "EURCAD") { S1_Reference = 100007 ; S2_Reference = 100107 ; }

if (StringSubstr(Symbol(), 0, 6) == "EURCHF") { S1_Reference = 100008 ; S2_Reference = 100108 ; }

if (StringSubstr(Symbol(), 0, 6) == "EURGBP") { S1_Reference = 100009 ; S2_Reference = 100109 ; }

if (StringSubstr(Symbol(), 0, 6) == "EURJPY") { S1_Reference = 100010 ; S2_Reference = 100110 ; }

if (StringSubstr(Symbol(), 0, 6) == "EURUSD") { S1_Reference = 100011 ; S2_Reference = 100111 ; }

if (StringSubstr(Symbol(), 0, 6) == "GBPCHF") { S1_Reference = 100012 ; S2_Reference = 100112 ; }

if (StringSubstr(Symbol(), 0, 6) == "GBPJPY") { S1_Reference = 100013 ; S2_Reference = 100113 ; }

if (StringSubstr(Symbol(), 0, 6) == "GBPUSD") { S1_Reference = 100014 ; S2_Reference = 100114 ; }

if (StringSubstr(Symbol(), 0, 6) == "NZDJPY") { S1_Reference = 100015 ; S2_Reference = 100115 ; }

if (StringSubstr(Symbol(), 0, 6) == "NZDUSD") { S1_Reference = 100016 ; S2_Reference = 100116 ; }

if (StringSubstr(Symbol(), 0, 6) == "USDCHF") { S1_Reference = 100017 ; S2_Reference = 100117 ; }

if (StringSubstr(Symbol(), 0, 6) == "USDJPY") { S1_Reference = 100018 ; S2_Reference = 100118 ; }

if (StringSubstr(Symbol(), 0, 6) == "USDCAD") { S1_Reference = 100019 ; S2_Reference = 100119 ; }

if (S1_Reference == 0) { S2_Reference = 100998 ; }

if (S2_Reference == 0) { S2_Reference = 100999 ; }

Link to comment
Share on other sites

Re: Megadroid Pro

 

Here's my own custom-modded MegadroidPro XE (Xtra Education!) which I thought I would share.

Unfortunately it was too big to attach onto the forum directly.

 

Based off the good work of Don and bbrain. Many kudos to both of you.

Thanks to Xpertadvisor for the hints on the logic settings.

 

Password is the name of this forum, in lower-case, without the .com

Don't forget the hyphen!

 

 

And kudos RIO, for your version.

I get some strange behaviour which I cannot reproduce systematically: immediate crashes when applying the EA (XE version), even tried virgin new installation, then again it worked on older ones, it might have to do with "calling process ID" which it needs to do. If I dont enable dll, I get error message so I have to enable that. (All this on ALPARI UK only). Still experimenting...

Link to comment
Share on other sites

Re: Megadroid Pro

 

Re: Megadroid Pro

Here's my own custom-modded MegadroidPro XE (Xtra Education!) which I thought I would share.

 

Rio,

 

Thank you for your nice work. I have hesitated though, at the 'maximum spread' variable. It is stated in your explanations as 'If MaxSpread set to 0 (zero), then MegaDroid's default built-in spread limits are used.' If I'm not wrong megaddroid safe (default) spread is 3 (30pips for 5 digit brokers). You set maximum spread as 0 (default) but S1 and S2 maximum spreads are set as '4'. Should it be let as they are or should be multiplied by 10 for 5 digit brokers?

 

Best regards,

 

Metin

Link to comment
Share on other sites

Re: Megadroid Pro

 

Thanks for warning. I'm testing it on TadawulFX. I also read about different demo and live data feed of this broker on forexpeacearmy (they denied it though). I'm planing trading 100:1, 0.1 standard lot, so getting filled (liquidity) shouldn't be a problem. I'll run demo and live MT4 terminal at the same time so if I see a lot of difference (lots of requotes, slow fills etc.) I'll just redraw my funds and close account.

 

unikin how did you finf tadulfx? is it true about different feed/requotes etc?

Link to comment
Share on other sites

Re: Megadroid Pro

 

Anyone know how to solve this problems?

 

[spoiler:23jail2j]This EA wont trade and there is message:

MegaDroidPro_bbr_v07 EURCHF,M15: Sell operation failed - error(4107): invalid price parameter for trade function

MegaDroidPro_bbr_v07 EURCHF,M15: OrderSend error 4107][/spoiler:23jail2j]

 

thank u b4..

Link to comment
Share on other sites

Re: Megadroid Pro

 

If I dont enable dll, I get error message so I have to enable that. (All this on ALPARI UK only). Still experimenting...

 

That's your problem right there.

While the unplugged MegadroidPros no longer uses the megadroidpro.dll, there is still a call to the generic kernel32.dll to handle the process and system time information. You will still need to allow dll calls or this won't work.

I use Alpari UK on a live account and have no problems.

 

I have hesitated though, at the 'maximum spread' variable. It is stated in your explanations as 'If MaxSpread set to 0 (zero), then MegaDroid's default built-in spread limits are used.' If I'm not wrong megaddroid safe (default) spread is 3 (30pips for 5 digit brokers). You set maximum spread as 0 (default) but S1 and S2 maximum spreads are set as '4'. Should it be let as they are or should be multiplied by 10 for 5 digit brokers?

 

Hmmm.. good question.

 

It seems that Don should have set MaxSpread as a double and then:-

 g_spread_588 = MaxSpread * gd_596

to enable the conversion for either 4 or 5 digits....

That way there's some uniformity when setting the max spread.... and you can even add a max spread with a decimal place if you are on a 5-digit broker....

 

Unless someone can see a problem with that, I'll fix it for the next version. I'll even add MaxSpread to the EA comment display so you can see how it is set at a glance.

 

I'll also add collinsmith's fix for magic numbers as well.....and I'll remove the reciept code like I said I would ;)

I might add some extra preset files to be able to set the CUSTOM logic's defaults for the other pairs, simply for testing purposes.

 

On a seperate note, last night's trading was really lackluster. Only the GU and USDCAD took a shot for me, but they both chose to close just above breakeven. Still profitted, but not much.

Link to comment
Share on other sites

Re: Megadroid Pro

 

I'm running it with the auto GMT. It seems to be +2

 

Here's an updated version of MegadroidPro XE (now v1.1)

 

Included is a fix to Don's MaxSpread input. It is now a double, and not an int, and it will be automatically converted to something functional if you give it a positive value. You no longer need to multiply by 10 on a 5-digit broker.... but you can manually set the decimal place for your own fine-tuning if you have 5-digits. (Naturally enough, the decimal place will be useless on a 4-digit broker.)

 

You can now also check the status of the MaxSpread from the chart you place the EA on too.

You will either be told that it's disabled, default, or the value that you've set the max spread to.

(Note that the MaxSpread, if you set it to a positive value, will be active on BOTH strategies... which is why the display won't show a value if you simply use the defaults. MaxSpreads sometimes differ between supported pair strategies.)

 

I could have also turned the individual logic max spreads into doubles too, but I didn't want to mess with the system too much.

 

Also included collinsmith's fix, and a few other tweaks and cleanups to the inputs. Someone who watches a lot of TV may note the significance of the new "magic numbers" ;)) Of course they do not affect how the EA trades.

 

I also cleaned up the readme.

 

In the package I have inlcuded presets for the other supported pairs, loaded into the CUSTOM logic settings, in case you want to tweak the defaults through optimization or something.

 

Let me know of any problems.

Same password as before. It's the name of this website. Between the http:// and the .com ;)

 

Now all we have to do is generate a pile of good CUSTOM logic presets for other pairs.....

Link to comment
Share on other sites

Re: Megadroid Pro

 

I'm running it with the auto GMT. It seems to be +2

 

Here's an updated version of MegadroidPro XE (now v1.1)

 

Included is a fix to Don's MaxSpread input. It is now a double, and not an int, and it will be automatically converted to something functional if you give it a positive value. You no longer need to multiply by 10 on a 5-digit broker.... but you can manually set the decimal place for your own fine-tuning if you have 5-digits. (Naturally enough, the decimal place will be useless on a 4-digit broker.)

 

You can now also check the status of the MaxSpread from the chart you place the EA on too.

You will either be told that it's disabled, default, or the value that you've set the max spread to.

(Note that the MaxSpread, if you set it to a positive value, will be active on BOTH strategies... which is why the display won't show a value if you simply use the defaults. MaxSpreads sometimes differ between supported pair strategies.)

 

I could have also turned the individual logic max spreads into doubles too, but I didn't want to mess with the system too much.

 

Also included collinsmith's fix, and a few other tweaks and cleanups to the inputs. Someone who watches a lot of TV may note the significance of the new "magic numbers" ;)) Of course they do not affect how the EA trades.

 

I also cleaned up the readme.

 

In the package I have inlcuded presets for the other supported pairs, loaded into the CUSTOM logic settings, in case you want to tweak the defaults through optimization or something.

 

Let me know of any problems.

 

hxxp://[email protected]/file/124307161/4e28200d/MegadroidPro_XE.html

Same password as before. It's the name of this website. Between the http:// and the .com ;)

 

Now all we have to do is generate a pile of good CUSTOM logic presets for other pairs.....

 

Thank you for your efforts! :) Which dll do you use? Best regards!

Link to comment
Share on other sites

Re: Megadroid Pro

 

 

Thank you for your efforts! :) Which dll do you use? Best regards!

 

from the "Read Me":

 

" The EA no longer communicates over the internet, or even with the original

DLL file. You will still need to "Allow DLL imports" however, as

kernel32.dll is accessed to get process IDs and system time information."

 

thanks Rio! I´ll give it a try. :)

Link to comment
Share on other sites

Re: Megadroid Pro

 

Sorry everyone...

 

Just a quick fix to the EA. I added the word "pips" into the MaxSpread display if you set to a positive value.

I put this in just so everyone doesn't get confused between spread and pips on a 5-digit broker.

 

No need to update to this if you just downloaded the latest v1.1.

For everyone else, get this one:-

 

hxxp://[email protected]/file/124315018/ee1e8562/MegadroidPro_XE.html

Same password as before. It's the name of this website. Between the http:// and the .com

 

...and yes, kernel32.dll is a generic Windows system call I believe.

Link to comment
Share on other sites

Re: Megadroid Pro

 

Today results of USDJPY is very bad, we loss in live account $ 64.3 and $ 65.33

demo account loss too, but other pair is good

Do Anyone affected this problem? #:-S

 

The USDJPY pair is profitable in 10 year backtesting, but nowhere near as profitable as the other supported pairs.

I wouldn't use it live.... until it gets optimized.

 

Even then, it's probably best avoided because the JPY gets traded during the asian session! (obvious, hey?). The AUD and NZD have the same problem of course.

 

As I have found in some preliminary optimization, trading it around 23-24 hr is a bit risky.

 

GBPCHF, EURCAD, would be better pairs to trade on top of GBPUSD and USDCAD, except that the spreads for the former two pairs are usually too high.

Link to comment
Share on other sites

Re: Megadroid Pro

 

Rio, i agree with you. Using MD on currency pairs which are active during Asian session is risky.

Why take unnecessary risk when we can increase the lots traded for safer pairs like EURUSD?

 

I notice that the EURUSD actually trades better with EURCHF logic!

Makes me think that we can even optimize the default pairs even further.

 

Still one tiny problem with XE v1.1 however. Charts that have risk sharing as true see charts that have risk sharing off as being another node for risk sharing. Not sure how to fix this one....

Link to comment
Share on other sites

Re: Megadroid Pro

 

I notice that the EURUSD actually trades better with EURCHF logic!

Makes me think that we can even optimize the default pairs even further.

 

hi Rio,

what about using EURGBP logic? because i use this logic for EURUSD and completely satisfied...

 

like to hear from you

 

:)>-

LAL: Laugh At Life

it's too short to be sad..

Link to comment
Share on other sites

Re: Megadroid Pro

 

Using JUINERTY2's USDJPY settings (Logic = 2 ; hours S1=20-21, S2=20-22), I had the following live trades last night on FXCBS:

 

228039 2009.08.10 23:14 sell 0.10 usdjpy.. 97.129 97.543 96.532 2009.08.11 00:23 97.130 -0.80 0.00 -0.31 -0.10

228040 2009.08.10 23:14 sell 0.10 usdjpy.. 97.199 97.610 96.702 2009.08.11 00:15 97.158 -0.80 0.00 -0.31 4.22

228474 2009.08.11 00:32 buy 0.10 usdjpy.. 97.088 96.678 97.683 2009.08.11 05:32 96.869 -0.80 0.00 0.00 -22.61

 

Obviously not a great night, but not a disaster either. Much better than the MD Multi (Aggressive=True, Recovery=True, Risk=0.10) hit live last night on JadeFX:

 

857252 2009.08.10 23:08 buy 0.60 usdjpyjfx 97.027 96.714 97.525 2009.08.11 01:09 97.028 -3.00 0.00 0.00 0.62

857345 2009.08.11 00:09 buy 0.50 usdjpyjfx 96.977 96.484 97.570 2009.08.11 11:15 96.483 -2.50 0.00 0.00 -256.00

 

I'll see how these continue to work (or not) in forward test.

Link to comment
Share on other sites

Re: Megadroid Pro

 

Today results of USDJPY is very bad, we loss in live account $ 64.3 and $ 65.33

demo account loss too, but other pair is good

Do Anyone affected this problem? #:-S

 

I was stopped out on this too, however it is one of my demo pairs. Interestingly I also also had the pair open using Juinerty's custom time settings and it took two trades one for one pip and one for four pips, both positive. FXDD is my broker

 

15021457 2009.08.10 23:08 sell 0.50 usdjpy 97.12 97.55 96.52 2009.08.11 00:29 97.11 0.00 0.00 -0.93 5.15

15021855 2009.08.10 23:14 sell 0.50 usdjpy 97.20 97.63 96.70 2009.08.11 00:15 97.16 0.00 0.00 -0.93 20.58

 

It did not take the bad trade. Great work Juinerty ^:)^ Also the eurusd took two trades using logic 2 and no trades under default logic 1 :huh:

 

15025891 2009.08.11 01:03 sell 0.50 eurusd 1.4146 1.4188 1.4086 2009.08.11 02:05 1.4137 0.00 0.00 0.00 45.00

15027535 2009.08.11 02:06 buy 0.50 eurusd 1.4135 1.4093 1.4195 2009.08.11 03:11 1.4138 0.00 0.00 0.00 15.00

 

regards

 

N

Link to comment
Share on other sites

Re: Megadroid Pro

 

I use this code to solve the problem in all my EAs

(replace S1_reference with magic or Magic witch name is use in the EA)

(replace 100 with 101, 102 ... for each ea

 

if (StringSubstr(Symbol(), 0, 6) == "AUDCAD") { S1_Reference = 100001 ; S2_Reference = 100101 ; }

if (StringSubstr(Symbol(), 0, 6) == "AUDJPY") { S1_Reference = 100002 ; S2_Reference = 100102 ; }

if (StringSubstr(Symbol(), 0, 6) == "AUDNZD") { S1_Reference = 100003 ; S2_Reference = 100103 ; }

if (StringSubstr(Symbol(), 0, 6) == "AUDUSD") { S1_Reference = 100004 ; S2_Reference = 100104 ; }

if (StringSubstr(Symbol(), 0, 6) == "CHFJPY") { S1_Reference = 100005 ; S2_Reference = 100105 ; }

if (StringSubstr(Symbol(), 0, 6) == "EURAUD") { S1_Reference = 100006 ; S2_Reference = 100106 ; }

if (StringSubstr(Symbol(), 0, 6) == "EURCAD") { S1_Reference = 100007 ; S2_Reference = 100107 ; }

if (StringSubstr(Symbol(), 0, 6) == "EURCHF") { S1_Reference = 100008 ; S2_Reference = 100108 ; }

if (StringSubstr(Symbol(), 0, 6) == "EURGBP") { S1_Reference = 100009 ; S2_Reference = 100109 ; }

if (StringSubstr(Symbol(), 0, 6) == "EURJPY") { S1_Reference = 100010 ; S2_Reference = 100110 ; }

if (StringSubstr(Symbol(), 0, 6) == "EURUSD") { S1_Reference = 100011 ; S2_Reference = 100111 ; }

if (StringSubstr(Symbol(), 0, 6) == "GBPCHF") { S1_Reference = 100012 ; S2_Reference = 100112 ; }

if (StringSubstr(Symbol(), 0, 6) == "GBPJPY") { S1_Reference = 100013 ; S2_Reference = 100113 ; }

if (StringSubstr(Symbol(), 0, 6) == "GBPUSD") { S1_Reference = 100014 ; S2_Reference = 100114 ; }

if (StringSubstr(Symbol(), 0, 6) == "NZDJPY") { S1_Reference = 100015 ; S2_Reference = 100115 ; }

if (StringSubstr(Symbol(), 0, 6) == "NZDUSD") { S1_Reference = 100016 ; S2_Reference = 100116 ; }

if (StringSubstr(Symbol(), 0, 6) == "USDCHF") { S1_Reference = 100017 ; S2_Reference = 100117 ; }

if (StringSubstr(Symbol(), 0, 6) == "USDJPY") { S1_Reference = 100018 ; S2_Reference = 100118 ; }

if (StringSubstr(Symbol(), 0, 6) == "USDCAD") { S1_Reference = 100019 ; S2_Reference = 100119 ; }

if (S1_Reference == 0) { S2_Reference = 100998 ; }

if (S2_Reference == 0) { S2_Reference = 100999 ; }

 

 

A good way to caculate Every pair's MagicNumber automaticly , we can simple using this function:

 

int LqysMagicNumberFromCurSymbol()

{

int nMagicNumber=0;

string CurSym = Symbol();

for (int i=0; i<5; i++)

{

nMagicNumber=nMagicNumber*3+StringGetChar(CurSym,i);

}

 

nMagicNumber=nMagicNumber*3+5918 + Period();

return(nMagicNumber);

}

 

then you can using this code in Init() :

 

MagiceNumber = LqysMagicNumberFromCurSymbol();

Link to comment
Share on other sites

Re: Megadroid Pro

 

 

A good way to caculate Every pair's MagicNumber automaticly , we can simple using this function:

 

int LqysMagicNumberFromCurSymbol()

{

int nMagicNumber=0;

string CurSym = Symbol();

for (int i=0; i<5; i++)

{

nMagicNumber=nMagicNumber*3+StringGetChar(CurSym,i);

}

 

nMagicNumber=nMagicNumber*3+5918 + Period();

return(nMagicNumber);

}

 

then you can using this code in Init() :

 

MagiceNumber = LqysMagicNumberFromCurSymbol();

 

@qingyang2005: you always have good code snippets :P

Link to comment
Share on other sites

Re: Megadroid Pro

 

Yes good code, althought I prefer mine because I also add some parameters set for each pair.

 

Last night I get 2 profitables trades with MD_1.11 and 3 profitables with bbr07.

 

>> Chip4Pips : I get only 1 trade on USDJPY : 2009:08:11: 00:10 buy 0.68 usdjpy @ 97.02 close 02:14 @ 97.03

 

Dragonpips is another Ea that also perform very good in my demo account. must consider

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...