Jump to content

Megadroid Pro (links first post)


Recommended Posts

  • Replies 2.1k
  • Created
  • Last Reply

Top Posters In This Topic

Re: Megadroid Pro

 

I am trying to use this on jadefx but I assume that because they label pairs "EURUSDjfx" and so on that the other pairs won't be recognised and so will revert to EURUSD logic.

 

Looking at the code if I change

 

void SetSymbol(){
  if (Logic < 1 || Logic > 4) Logic = 1;
  if(Symbol() == "EURUSD" || Symbol() == "EURCHF" || Symbol() == "EURGBP" || Symbol() == "USDCHF") my_symbol = Symbol();
  else  {
     if (Logic == 1) my_symbol = "EURUSD";
     if (Logic == 2) my_symbol = "EURCHF";
     if (Logic == 3) my_symbol = "EURGBP";
     if (Logic == 4) my_symbol = "USDCHF";

 

to read

 

void SetSymbol(){
  if (Logic < 1 || Logic > 4) Logic = 1;
  if(Symbol() == "EURUSDjfx" || Symbol() == "EURCHFjfx" || Symbol() == "EURGBPjfx" || Symbol() == "USDCHFjfx") my_symbol = Symbol();
  else  {
     if (Logic == 1) my_symbol = "EURUSDjfx";
     if (Logic == 2) my_symbol = "EURCHFjfx";
     if (Logic == 3) my_symbol = "EURGBPjfx";
     if (Logic == 4) my_symbol = "USDCHFjfx";

 

that should fix the problem?

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:

 

I wonder how this could be modified so it not only draws inspiration from the symbol, but also the account number.

That way there's very little chance of anybody having the same magic number.

Link to comment
Share on other sites

Re: Megadroid Pro

 

Heres the routine I use...

 

extern int MagicRandomizer =3;

 

int MagicNumber;

 

 

void SetMagicNumber()

{

string iSymbol = "i "+Symbol();

MagicNumber = 0;

 

if (StringFind(iSymbol, "AUDCAD", 0) > 0) MagicNumber = 10;

if (StringFind(iSymbol, "AUDJPY", 0) > 0) MagicNumber = 20;

if (StringFind(iSymbol, "AUDNZD", 0) > 0) MagicNumber = 30;

if (StringFind(iSymbol, "AUDUSD", 0) > 0) MagicNumber = 40;

if (StringFind(iSymbol, "CHFJPY", 0) > 0) MagicNumber = 50;

if (StringFind(iSymbol, "EURAUD", 0) > 0) MagicNumber = 60;

if (StringFind(iSymbol, "EURCAD", 0) > 0) MagicNumber = 70;

if (StringFind(iSymbol, "EURCHF", 0) > 0) MagicNumber = 80;

if (StringFind(iSymbol, "EURGBP", 0) > 0) MagicNumber = 90;

if (StringFind(iSymbol, "EURJPY", 0) > 0) MagicNumber = 100;

if (StringFind(iSymbol, "EURUSD", 0) > 0) MagicNumber = 110;

if (StringFind(iSymbol, "GBPCHF", 0) > 0) MagicNumber = 120;

if (StringFind(iSymbol, "GBPJPY", 0) > 0) MagicNumber = 130;

if (StringFind(iSymbol, "GBPUSD", 0) > 0) MagicNumber = 140;

if (StringFind(iSymbol, "NZDJPY", 0) > 0) MagicNumber = 150;

if (StringFind(iSymbol, "NZDUSD", 0) > 0) MagicNumber = 160;

if (StringFind(iSymbol, "USDCHF", 0) > 0) MagicNumber = 170;

if (StringFind(iSymbol, "USDJPY", 0) > 0) MagicNumber = 180;

if (StringFind(iSymbol, "USDCAD", 0) > 0) MagicNumber = 190;

if (StringFind(iSymbol, "XAUUSD", 0) > 0) MagicNumber = 200;

if (StringFind(iSymbol, "XAGUSD", 0) > 0) MagicNumber = 210;

if (StringFind(iSymbol, "GOLD", 0) > 0) MagicNumber = 220;

if (StringFind(iSymbol, "#CL", 0) > 0) MagicNumber = 230;

if (StringFind(iSymbol, "DJI", 0) > 0) MagicNumber = 240;

if (StringFind(iSymbol, "NASDAQ", 0) > 0) MagicNumber = 250;

if (StringFind(iSymbol, "SP500", 0) > 0) MagicNumber = 260;

if (StringFind(iSymbol, "SILVER", 0) > 0) MagicNumber = 270;

 

 

 

if( MagicNumber == 0 ) { MagicNumber = 1000; }

 

if (Period()== PERIOD_MN1) {MagicNumber=MagicNumber +9;}

else if (Period()== PERIOD_W1) MagicNumber=MagicNumber +8;

else if (Period()== PERIOD_D1) MagicNumber=MagicNumber +7;

else if (Period()== PERIOD_H4) MagicNumber=MagicNumber +6;

else if (Period()== PERIOD_H1) MagicNumber=MagicNumber +5;

else if (Period()== PERIOD_M30) MagicNumber=MagicNumber +4;

else if (Period()== PERIOD_M15) MagicNumber=MagicNumber +3;

else if (Period()== PERIOD_M5) MagicNumber=MagicNumber +2;

else if (Period()== PERIOD_M1) MagicNumber=MagicNumber +1;

else MagicNumber=MagicNumber + 1010;

 

if (MagicRandomizer <= 0) MagicRandomizer=1;

 

MagicNumber = ((MagicRandomizer * MagicNumber + AccountNumber())/111);

 

return (MagicNumber);

}

Link to comment
Share on other sites

Re: Megadroid Pro

 

forexample, your code will not fix the problem. Just simply delete the useless codes, and you will be fine. The following code will be good for any brokers with different currency pair names.

 

void SetSymbol() {

if (Logic < 1 || Logic > 4) my_symbol = "EURUSD";

else if (Logic == 1) my_symbol = "EURUSD";

else if (Logic == 2) my_symbol = "EURCHF";

else if (Logic == 3) my_symbol = "EURGBP";

else if (Logic == 4) my_symbol = "USDCHF";

}

Link to comment
Share on other sites

Re: Megadroid Pro

 

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);

}

 

If you want to generate a random number, it would make sense to use MathRand (http://docs.mql4.com/math/MathRand) than some of the calculations you've done there (e.g. *3+5918... why 3? why 5918?)

Link to comment
Share on other sites

Re: Megadroid Pro

 

hi Rio,

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

 

like to hear from you

:)>-

 

Yes, you're right. EURUSD with EURGBP logic kicks the other logics in the balls. :-bd

This just makes me want to heavily optimize the EURUSD logics.... who knows if it can't be pushed further?

Then perhaps we can run multiple profitable logics on the same pair (which brokers will be helpless to resist!)

Link to comment
Share on other sites

Re: Megadroid Pro

 

If you want to generate a random number, it would make sense to use MathRand (http://docs.mql4.com/math/MathRand) than some of the calculations you've done there (e.g. *3+5918... why 3? why 5918?)

 

I was thinking the same thing.

Take a random number, account number, symbol characters, multiply them all together, take the resulting number, and cut it down to 9 digits.

Then take that same number, multiply it by 2, cut that down to 9 digits, and use it for the second magic number.

Problem solved.

 

Also, it would help if the EA could recalculate the number automatically every day, week or something.

 

(now it just needs to be coded)

Link to comment
Share on other sites

Re: Megadroid Pro

 

re auto magic number: you would need to be careful about what happens to the number during say a system restart in the middle of the trade. The magicno might be recalculated on reinitialization hence lose connection to the open trade. May need to use a GlobalVariable to keep track of it during a trade which is then reset to zero when trade is closed.

 

I think another expert did this well, maybe artemis breakout advisor from memory?

Link to comment
Share on other sites

Re: Megadroid Pro

 

You only need to generate a randon number and not do any other calculations.

Though incorporating the symbol characters can help to avoid a situation where different order symbols end up with the same magic number (albeit a rare case).

Introducing account number would not help at all, nor any other arbitrary divisions or multiplications with constant numbers.

 

engtraderfx, yes that's a good point about needing to use GlobalVariables in case of terminal shutdown and restart.

 

Here's some code that I've just played with (including code to use GlobalVariables) that works for me:

 string symbol = Symbol();

 int magicNumber1 = GlobalVariableGet("MegaDroid_MagicNumber1_" + symbol);
 int magicNumber2 = GlobalVariableGet("MegaDroid_MagicNumber2_" + symbol);

 if(magicNumber1 == 0)
 {
   int symbolLength = StringLen(symbol);
   for (int i = 0; i < symbolLength; i++) magicNumber1 += StringGetChar(symbol, i);

   MathSrand(TimeLocal()); //seed the pseudorandom-number generator before calling MathRand.
   magicNumber1 += MathRand(); //The MathRand function returns a pseudorandom integer within the range of 0 to 32767.
   magicNumber2 = magicNumber1 + 1; //Add 1 just to make it different to magicNumber1

   if(GlobalVariableSet("MegaDroid_MagicNumber1_" + symbol, magicNumber1) == 0 || GlobalVariableSet("MegaDroid_MagicNumber2_" + symbol, magicNumber2) == 0) Print(GetLastError());
 }
      
 Print("magicNumber1 = " + magicNumber1);
 Print("magicNumber2 = " + magicNumber2);

 

The output I get from this is something like:

magicNumber1 = 23766

magicNumber2 = 23767

 

When I then shut down and restart the terminal I get the same numbers because the values were stored in the Global Variables. You can see the globabl variables in the terminal by clicking on F3.

Link to comment
Share on other sites

Re: Megadroid Pro

 

Before you guys dive deep into hours or days of backtesting and optimization, take note of what I've repeatedly been saying about the data that you are using: the data you get from the MetaTrader terminal is largely junk. Testing over junk data, especially for scalping strategies like MegaDroid in which a few pips make a big difference, is a waste of time. We need higher quality data.

 

Also, regarding testing methodology, if you're going to test as a group, each of you should be using exact copies of the same historical data set and use consistent parameter values.

You should set Risk Level to 0 so that trade size is constant over the test period. This allows you to properly see the performance over the test period. Otherwise you can't properly compare drawdowns at different points in time over the test period... you'd need a graph on a logarithmic scale to do it.

 

Here's a thread on mql4.com from just a couple of days ago: http://forum.mql4.com/24815 ("Backtest results vastly different with importing alpari data vs downloading data from MT4")

 

I've mentioned this before, but I'll say it again for those who missed it: you shouldn't use Alpari data (either from their web site (but no longer available) or through their MetaTrader terminal (which is actually MetaQuotes data)) for backtesting unless you are going to handle the UTC offset change during daylight savings each year. The MegaDroid manual says to use a constant offset of 1 when backtesting over Alpari data, but I think they think most of their customers are stupid. Does it really make sense to backtest and optimize with a constant UTC offset of 1 (even though the data does not have constant UTC offset) and then go and trade live/demo with an offset of 2? NO.

 

I spent some painstaking hours finding exactly when Alpari switches their UTC offset in the historical data. The data I examined was from Alpari's MetaTrader terminal (which is actually MetaQuotes data with time shifted to match their server UTC offsets). Here are the results:

 

< 1999-10-28, UTC offset = 2

>= 1999-10-28 00:00 && < 2000-03-30 23:00, UTC offset = 1

>= 2000-03-31 00:00 && < 2000-10-24 00:00, UTC offset = 2

>= 2000-10-24 00:00 && < 2001-03-30 23:00, UTC offset = 1

>= 2001-03-31 00:00 && < 2001-10-22 00:00, UTC offset = 2

>= 2001-10-22 00:00 && < 2002-03-30 23:00, UTC offset = 1

>= 2002-03-31 00:00 && < 2002-10-28 00:00, UTC offset = 2

>= 2002-10-28 00:00 && < 2003-03-30 23:00, UTC offset = 1

>= 2003-03-31 00:00 && < 2003-10-27 00:00, UTC offset = 2

>= 2003-10-27 00:00 && < 2004-03-30 23:00, UTC offset = 1

>= 2004-03-31 00:00 && < 2004-10-28 00:00, UTC offset = 2

>= 2004-10-28 00:00 && < 2005-03-31 00:00, UTC offset = 1

>= 2005-03-31 01:00 && < 2005-10-26 00:00, UTC offset = 2

>= 2005-10-26 00:00 && < 2006-03-31 02:00, UTC offset = 1

>= 2006-03-31 03:00 && < 2006-10-24 00:00, UTC offset = 2

>= 2006-10-24 00:00 && < 2007-03-31 02:00, UTC offset = 1

>= 2007-03-31 03:00 && < 2007-10-22 00:00, UTC offset = 2

>= 2007-10-22 00:00 && < 2008-03-31 01:00, UTC offset = 1

>= 2008-03-31 02:00 && < 2008-10-27 00:00, UTC offset = 2

>= 2008-10-27 00:00 && < 2009-03-31 01:00, UTC offset = 1

>= 2009-03-31 02:00, UTC offset = 2

 

If you don't write any code to handle this UTC offset switching, then your backtest over such data will be even more seriously flawed than it already is, especially considering that MegaDroid only trades within a narrow 2 hour window each day.

Link to comment
Share on other sites

Re: Megadroid Pro

 

Roger that.

 

FYI, I'm using FXDD data... I'm getting a spread of 2 on the EURUSD from their demo server.

At the moment, I'm optimizing the EURUSD... risk is set to 0.0, aggressive is off (so to not activate the S2), so I can optimize the S1 only, during MD's standard trading hours. After this I will optimize S2 with agressive on, and use the settings I discover with S1. After this I'll optimize the "Advanced droid tactics" time frames and see what I can come up with there, repeating the process again.

 

It's going to take a lot of time, but I have access to a number of reltively fast machines :)>-

 

I think our best effort is actually in increasing the effectiveness of the supported pairs with low spreads over multiple time frames. After that, we can worry about the unsupported pairs.

Link to comment
Share on other sites

Re: Megadroid Pro

 

I am trying to use this on jadefx but I assume that because they label pairs "EURUSDjfx" and so on that the other pairs won't be recognised and so will revert to EURUSD logic.

 

Looking at the code if I change

 

For a more generic symbol check, you just need to search for the first 6 characters in a symbol, I use following:

 

if (StringSubstr(Symbol(), 0, 6) != USDCHF) {do whatever.....} 

Link to comment
Share on other sites

Re: Megadroid Pro

 

Hi guys, just want to let you all know... regarding using a different logic on EURUSD, I have this setup on a demo account, over the last 2 days I have seen some different trade results with different logic, and also trades from other logic opened and closed with profit while no trades using default logic.

I will post the results for you guys this weekend.

 

Actually I'm planning to have a 1st best logic, and a 2nd best logic for some of the pairs. For example, insead of going 0.20 lot using logic 1, I would split it to 0.10 x 2, using 2 different logics. From what I have tested, it is not recommended to double up the risk. When 1 logic fails, it is very likely the other will have a losing trade as well, if you are lucky, you get 1 loss and 1 break even. This way you get more trades, more profits... while maintainig about the same risk.

Link to comment
Share on other sites

Re: Megadroid Pro

 

And oh, if you do what I just said, you might want to disable aggressive settings... if you are not confortable to see 4 trades on eurusd entered at the same time.

This is very likely happen...

 

Or as someone else mentioned earlier, make the S2 only 50% lot size of S1 strategy... (I haven't tested this myself though)

Link to comment
Share on other sites

Re: Megadroid Pro

 

For a more generic symbol check, you just need to search for the first 6 characters in a symbol, I use following:

 

if (StringSubstr(Symbol(), 0, 6) != USDCHF) {do whatever.....} 

 

This code already seems to be in my version of MegadroidPro XE

 

void SetSymbol(){
  my_symbol = StringSubstr(Symbol(), 0, 6);
  if (Logic < 1 || Logic > 5) Logic = 1;
  if( OverrideDefaultLogic || ( my_symbol != "EURUSD" && my_symbol != "EURCHF" && my_symbol != "EURGBP" && my_symbol != "USDCHF") )
  {
     if (Logic == 1) my_symbol = "EURUSD";
     if (Logic == 2) my_symbol = "EURCHF";
     if (Logic == 3) my_symbol = "EURGBP";
     if (Logic == 4) my_symbol = "USDCHF";
     if (Logic == 5) my_symbol = "CUSTOM";
  }
}

Link to comment
Share on other sites

Re: Megadroid Pro

 

re: data quality, after playing a bit with the dukasopy demo, I read on their forum the data is all GMT 0 based. Could an option be to download & import their data for testing? They also have < 1 min data which may help data quality??

 

I mentioned Dukascopy a while ago and recommended it, but I later found out that the free data is indicative data as opposed to real data from a trade server. Here is what it says on the page (http://www.dukascopy.com/swiss/english/data_feed/csv_data_export/)

The data used is taken from various third parties informational sources. This data differs from Dukascopy’s trading feed and can be used only for informational purposes.

 

Though if you look at this page you'll see that the guy backtested (using JForex historical tester) Fap Turbo Evolution over Dukascopy's tick data: http://trading-gurus.com/the-fapturbo-evolution-backtesting-blues-track-1/

I presume the JForex historical tester test over real tick data from Dukascopy's own servers, but I'm not sure how to get the data (without using JForex historical tester) or whether it's exportable from JForex historical tester.

 

 

I spent some time working with Gain Capital's tick data and managed to convert their EURUSD data to MetaTrader HST files. Here's the equity curve of a backtest of MegaDroidPro over the data:

StrategyTester__EURUSD_Spread=1.8_S1TpDistance4DPips=10_DistanceFromMa4DPips=10_Gain HST_DateRange=2002.01.01to2009.07.01_large.gif[/attachment:vbzigohl]

 

Parameters:

From date = 2002.01.01

To date = 2009.07.01

Aggressive = false

RiskLevel = 0

Stealth = false

GmtOffset = 0

Lot size = 0.1

 

 

Over this data, it's a big loser until the end of 2005, though the data quality may not be good for the early years. I ran the historical data anaylsis script to find holes in the M1 data, and here's what I found:

 

year       number of holes of 3 bars or more
2000       6464
2001       8347
2002       5989
2003       3836
2004       2874
2005       3676
2006       5511
2007       6848
2008       1806
2009       293

Link to comment
Share on other sites

Re: Megadroid Pro

 

forexample, your code will not fix the problem. Just simply delete the useless codes, and you will be fine. The following code will be good for any brokers with different currency pair names.

 

void SetSymbol() {

if (Logic < 1 || Logic > 4) my_symbol = "EURUSD";

else if (Logic == 1) my_symbol = "EURUSD";

else if (Logic == 2) my_symbol = "EURCHF";

else if (Logic == 3) my_symbol = "EURGBP";

else if (Logic == 4) my_symbol = "USDCHF";

}

 

Thank you :)>-

Link to comment
Share on other sites

Re: Megadroid Pro

 

From "Show the best EA" post:

 

just MegaDroid pro !!!! :-bd

 

i'm live with it on 8 pairs: EURUSD,GBPUSD,USDJPY,EURGBP,EURJPY,USDCHF,EURCHF,USDCAD (in most profitable order)

(more than 400 pips :D just in 2 weeks)

 

happy trading :)>-

 

Hi reza_oscar,

 

Could you please tell me which broker you use and which version of Megadroid pro you use (MegaDroidPro_bbr_v07, MegaDroidPro_XE or other version)?

 

If possible, could also you give your settings for each currency pairs.

 

Many thanks.

Link to comment
Share on other sites

Re: Megadroid Pro

 

Hi bbrain/Rio,

 

If you are going to release an update, when you do that... please fix the "waitForContext()".

I'm not sure if the original MDP has this bug, or this is caused by the decompiler, it's buggy.

MDP tried to handle trade context issue by checking for IsTradeContextBusy() and then do a Sleep()... if it works, we probably shouldn't be getting any trade context error anymore. (but it still has this error)

 

The original code:

int waitForContext() {

for (int l_count_0 = 0; IsTradeContextBusy() && l_count_0 < 20; l_count_0++) Sleep(15);

if (l_count_0 >= 20) Print("Trade context is buisy more than ", DoubleToStr(15 * l_count_0 / 1000, 2), " seconds");

else

if (l_count_0 > 0) Print("Trade context was buisy ", DoubleToStr(15 * l_count_0 / 1000, 2), " seconds");

return (l_count_0);

}

 

 

The Sleep(15) = pause for 15 milliseconds!... loop for 20 times max, that is a maximum sleep time 0.3 second! When the trade context is busy due to another EA is either opening/modifying/closing an order, re-trying once every 15 milliseconds is not useful at all, even 0.3 second probably doesn't help at all.

 

I think the 15 should be changed to at least 500 or above to have some effect to wait till the other EA finishes its job.

Link to comment
Share on other sites

Re: Megadroid Pro

 

reza_oscar wrote:

just MegaDroid pro !!!! :-bd

 

i'm live with it on 8 pairs: EURUSD,GBPUSD,USDJPY,EURGBP,EURJPY,USDCHF,EURCHF,USDCAD (in most profitable order)

(more than 400 pips :D just in 2 weeks)

 

happy trading :)>-

 

 

Hi

 

Where i find that EA version??

Can you post a link to download plz? (or the page where they talk about) ...I'm unable to find it! :((

 

 

thanks

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...