My EA not running at all, throwing up global initialization failed, global initializtion critical error
-
practice.mq5
Hi, everyone, I am pretty new to EA and just concluded basic tutorials. So I decided to try out some stuffs but my EA isn't running at all.
Throwing up global initialization failed, global initialization critical error.I want anyone who can help to please help spot where I am getting it wrong.
Also, I will put the details of what I am trying to practice
Condition for buyingFirstly, check if there is no running trade or pending order, if this check is true, then opens 3 pending buy orders and 3 pending sell orders above and below the close price of the last 1 hour candle respectively.
These orders should be at equal interval of 20 pips from each other.(For example, if the close price of the last hour candle is 100, set the first pending buy order at 20 pips above, the second buy order at 40 pips above and the third at 60 pips above the 100 price, while the first pending sell orders will be 20 pips below, second will be 40 pips below, third one will be 60 pips below the 100 price).
No stop loss set, no take profit setCondition for closingClose all trades (both open and pending positions) at any instant the total profit of running trades is equal or greater than $20.
Here is already EA (.mq5 file) I have come up with
practice.mq5
. Thanks -
@Obimbs Can you please create a shared link like this so myself or one of the guys can take a look..>>

PS: I suggest having larger gaps between orders and a good stop loss strategy because of the huge moves that come quite often. I've tried your strategy in the past...just saying... :-))
-
Thank you @Morpheus_0.
Here is a shared copy as advice.
https://fxdreema.com/shared/Ggp9Flf3c.
And thank you for the suggestion on having larger gaps between orders and a good stop loss strategy. I will be expecting your help on the project -
Heh...Well I wouldn't go 'expecting' things my friend. No one here 'works' for FXD. We all just give freely of our time when possible*
However, I have good news and not so good news....
The good news is it looks like you've set everything up properly.
The not so good news is I can't see why you'd be getting the globalization errors...But I also deal more with MT4, not MT5.....
And so: Are you getting those error messages when using the MT5 Compiler...?
Have you tried it without the Delay blocks...? What are those even for...?
Regards*
-
Yes, I got the error message with MT5 compiler
I added the delay block to prevent overlapping of orders
I have not tried it without delay blocks. I will remove the delay block and see if it works -
@Obimbs said:
I added the delay block to prevent overlapping of orders
The two blocks above them should prevent that anyway....
Did it work....?
Also it won't open Buys AND Sells together unless you separate those in the No Position Blocks.....
-
Thank you. I have removed the delay block and it now works.
Like you predicted, it only open the buy orders, it did not open the sell orders.
You advised that i "separate those in the No position blocks", but I do not comprehend fully what you asked that I separate. Can you please throw more light on what you mean. Thanks. I appreciate -
Open the No Position/Orders Blocks and make it Buys for Buys and Sells for Sells....
Right now you have it "Either Buys or Sells".......*
-
The EA now works perfectly as I want it after following your recommendation.
Gratitudes for your time and help. I appreciate it -
Well done and you're welcome*