Molanis Mistake Anyone? - page 3

 

RJo:

Having said that, I have yet to see a functional ex4 with a defective mq4 from SB.

You have posted defective mql4 code . . . looks like Molanis is no better than EA Builder.
 
RJo:


Ah, so... computers are the best at trading and therefore the human should be dispensed with.


No.... computers are the best at Automated Trading ;)
 
RaptorUK:
You have posted defective mql4 code . . . looks like Molanis is no better than EA Builder.


"Defective" relative to the ex4 file, as in the ex4 being more functional than the mq4. As stated in my first post, I'm not a coder. Yeesh. Thanks for your specific diagnosis. Oh yeah... you didn't have one.

 
RJo:


"Defective" relative to the ex4 file, as in the ex4 being more functional than the mq4. As stated in my first post, I'm not a coder. Yeesh. Thanks for your specific diagnosis. Oh yeah... you didn't have one.

I don't need to duplicate what WHRoeder has already given . .
 
JDeel:

Why don't we start to program in assembler? We can control everything in the lowest level available (after machine code). Yes, it takes more effort to learn that, but we will surely get so small and super optimized code! This is soooooooo amazing, don't you think, people?

deVries, Molanis is not my tool and I have never made EA's using it. But I see you are not a fan of EA Builders and I can advice you to never try to work with them. Just use MQL4/MQL5, this is not forbidden. There are people to like pink color the most, and people to like blue color the most. It was always been that way and it will continue to be.


Don't change my words.... Proof us that you can code correctly an Expert Advisor with using your tool I wrote. Still I mean that...

I Never wrote Molanis is your tool. If you google for EABuilders then you will find others. Maybe you are a user of the NoProgra Builder...

and you think it is a tool that can code correctly your EA's for MetaTrader4 then proof it with that builder.

But there are people that advise to use EABuilders or promote it to use them..

If you wanna promoot any product then be sure that product is good by proving it

And still I haven't seen someone succeed in doing that....

The big disadvantage of those tools is that there gonna be people thinking it is not needed to know the basics of mq4, when a tool can make your product

But they don't know what quality they get.... from that tool. Or they don't recognize errors in programs they can get (free or not free) using the internet

 
RJo:

Thanks for your specific diagnosis. Oh yeah... you didn't have one.

I'll give you a specific example . . .

int CLOSELONG(string symbol_c) {
 CloseAllPositions(symbol_c,OP_BUY,MagicNumberLong);
 CloseAllPositions(symbol_c,OP_BUY,MagicNumberLong);
 return(0);
}

//CLOSESHORT closes short positions
/*
*** Generated with Molanis Strategy Builder 3.1 ***
*** www.molanis.com ***
*** Released 2010-02-20 ***
*/
int CLOSESHORT(string symbol_c) {
 CloseAllPositions(symbol_c,OP_SELL,MagicNumberShort);
 CloseAllPositions(symbol_c,OP_SELL,MagicNumberShort);
 return(0);
}

These 2 Functions call the same function twice . . CloseAllPositions, the first for Longs, the second for Shorts . . . why would it do that ? it does that to clean up the Orders it failed to close the first time that CloseAllPositions is run, why does it fail to close positions ? because the loop used to close these positions counts up and now down . . . and you already know why that fails as you have read the thread I created on this very subject.

So rather than understanding why some positions are left open the good folks over at Molanis have bodged a fix . . . call the same function a second time to tidy up after the first.

 

Thank you for posting Molanis code, RJo, I'll review it later - Molanis's lots calculation is very terrible. Think molanis / EA SB users are happy user, until they learn mql, and by then they will see Molanis/ EA SB from totally different point of view.

I think we better defend our money first than defend Molanis/EA SB - or our decision to use one. ;).

 
RJo:
Indi:


Thank you for posting the codes ....

As good as WHRoeder is in pointing out errors so quickly I'm not and it has no sense to say it again

But if you don't know how to code you can do something else you see here....

.

I did a test to see the behavior of the indicator and that gives also some kind of warning made two pictures

Testing on 1 Minute (makes the EA don't trade) starting 1 jan 2012

You see the behavior before test of the indicator in this pictore

And the behavior when the test starts

This behavior you will also see if you place in the test an EA that is not using the indicator

.

Looks like a total different behavior This Is also a warning to take a closer look to the code or the behavior of the indicator before you gonna use it

.

It looks like this code of the indicator is not made by Molanis because it begins with.....

// This is Not Tested , Use At Your Own Risk !

//+--------------------------------------------------------------------------+
//| 3 MA Cross w_Alert v2.mq4                                                |
//| Copyright © 2005, Jason Robinson (jnrtrading)                            |
//| http://www.jnrtading.co.uk                                               |
//| 3 ma conversion and Alert , David Honeywell , transport.david@gmail.com  |
//| http://finance.groups.yahoo.com/group/MetaTrader_Experts_and_Indicators/ |
//+--------------------------------------------------------------------------+

/*
  +-------------------------------------------------------------------------------+
  | Allows you to enter 3 ma periods and it will then show you and alert you at   |
  | which point the 2 faster ma's "OPEN" are both above or below the Slowest ma . |
  +-------------------------------------------------------------------------------+
*/   

Think the error of this indicator is that it calculates future

   for(i = 0; i <= limit; i++)
    {
      
      counter=i;
      Range=0;
      AvgRange=0;
      for (counter=i ;counter<=i+9;counter++)
       {
         AvgRange=AvgRange+MathAbs(High[counter]-Low[counter]);
       }
      Range=AvgRange/10;
       
      fasterMAnow      = iMA(NULL, 0, FasterMA, FasterShift, FasterMode, PRICE_CLOSE, i+1);
      fasterMAprevious = iMA(NULL, 0, FasterMA, FasterShift, FasterMode, PRICE_CLOSE, i+2);
      fasterMAafter    = iMA(NULL, 0, FasterMA, FasterShift, FasterMode, PRICE_CLOSE, i-1);
      
      mediumMAnow      = iMA(NULL, 0, MediumMA, MediumShift, MediumMode, PRICE_CLOSE, i+1);
      mediumMAprevious = iMA(NULL, 0, MediumMA, MediumShift, MediumMode, PRICE_CLOSE, i+2);
      mediumMAafter    = iMA(NULL, 0, MediumMA, MediumShift, MediumMode, PRICE_CLOSE, i-1);
      
      slowerMAnow      = iMA(NULL, 0, SlowerMA, SlowerShift, SlowerMode, PRICE_CLOSE, i+1);
      slowerMAprevious = iMA(NULL, 0, SlowerMA, SlowerShift, SlowerMode, PRICE_CLOSE, i+2);
      slowerMAafter    = iMA(NULL, 0, SlowerMA, SlowerShift, SlowerMode, PRICE_CLOSE, i-1);
When " i = 0 " then " i-1 " is future.....
 
WHRoeder:

Ichi_Cloud_EA.mql4 in no particular order

  1. external Is_micro_account instead of computing it via Market_info
  2. Using micro_account and NormalizeDouble assumes lotStep is 0.1 0r 0.01. No other broker defined values allowed.
  3. external FiveDigits instead of computing it. Only test for 3 or 5 allows standard pairs, jpy type pairs. Trading metals FAIL. Why the test for invalid settings.
  4. global PipMultiplier never reset back on chart change.
  5. lots of external bools can not be strategy tested.
  6. No reason to use two magic numbers
  7. Will only trade when hour between TradingStartTime and TradingEndTime. No possibility to set time over midnight (e.g. start 2000, end 0600, i.e. Sydney session only)
  8. Uses PreviousBarCount==Bars. Bars in unreliable (max bars in chart) Volume is unreliable (you can miss ticks) always use time.
  9. uses iClose(Symbol(),0,1) instead of the simpler and quicker Close[1]
  10. in Init Slippage = Slippage*PipMultiplier; means EACH TIME you change charts (pair or time frame) Slippage increases 3, 30, 300, 3000!!
  11. magiccond and other bool use if (condition) boolVar= true; else boolVar = false; when it could use the simplier boolVar = condition;
  12. Never caches values if (iClose() <> iCustom()) the exact same iClose and iCustom calls are called 4+ times.
  13. Counts up while closing. calls function twice. Counting up means it will miss every other order. Calling function twice means it fails on 4 or more open orders. Always count down.
  14. "M-ERROR : Expiration has to be at least 1 minute." just had a posting on this expiration period should be more then 10 minutes!
  15. For pending order, calls Normaliszedouble(price, Digits) which will not work when ticksize != Point

Being most concerned with #10, I investigated it first. I was in the middle of writing a giant support request to Molanis when I found this:

Slippage as used in the EA's code is an external integer variable (extern int).

"Before the execution of init() external variables will get values setup by a user in the settings toolbar and at the execution of init() external variables will have new values set by a user. Thus new values of external variables become valid from the moment of a new session (init - start - deinit) of an Expert Advisor that starts from the execution of init()." (https://book.mql4.com/variables/types).

So it appears that... while global variables are generally ignored in favor of old values at execution of init(), external variables are updated at execution of init(). Slippage remains set at 3 (or whatever I set this to) no matter how many times I change charts. I believe this is how the EA is designed to operate.

 
RJo:
So it appears that... while global variables are generally ignored in favor of old values at execution of init(), external variables are updated at execution of init().

Slippage remains set at 3 (or whatever I set this to) no matter how many times I change charts. I believe this is how the EA is designed to operate.

WRONG Did you even bother to READ the link you posted (https://book.mql4.com/variables/types) it says "Global variables are initialized only once before stating the execution of special functions."

Global and static variable are set when the EA is LOADED not during the deinit/init cycle.

Add a print statement just after the Slippage = Slippage * 10 and run it and change charts or time frames and look in the log if you don't want to believe the documentation of us..