Overwrite EA with new version - all orders closed?

 

Hi,

When I was running my EA on a demo account on MT4, I revised the same EA on the MetaEditor. When I clicked 'compile' on the MetaEditor, all orders were closed on the MT4.

Is this going to happen (all orders closed) also on real accounts (when the EA is overwritten with a new version)?

Regards,

Jesus

 

Re-compilation causes the EA to re-initialize, so your init() function gets invoked.

If closure of orders on initialization is not what you want to happen, then you'll need to amend your logic as it will do the same thing on a live account.

It is perfectly possible to avoid such behaviour by crafting the EA correctly.


CB

 
cloudbreaker wrote >>

If this is not what you want to happen, then you'll need to amend your logic as it will do the same thing on a live account.

It is perfectly possible to avoid such behaviour by crafting the EA correctly.

CB

I didnt have any code that told the EA to do so (close the orders when EA is removed).

The deinit() doesnt do anything.

This implies that this is an MT4 behavior. Is that correct?

What do we do to make it not do so (close existing orders)?

Regards,

Jesus

 
jcadong5:

This implies that this is an MT4 behavior. Is that correct?

What do we do to make it not do so (close existing orders)?

<This implies that this is an MT4 behavior. Is that correct?>

No, it is not.

<What do we do to make it not do so (close existing orders)?>

As I mentioned above, we need to make a change to your code.


CB

 
cloudbreaker wrote >>

<This implies that this is an MT4 behavior. Is that correct?>

No, it is not.

<What do we do to make it not do so (close existing orders)?>

As I mentioned above, we need to make a change to your code.

CB

CB,

Thanks!

I missed your first reply's "Re-compilation causes the EA to re-initialize, so your init() function gets invoked. ".

I just realized you answered my question already.

Thanks again!

 
jcadong5:

CB,

Thanks!

I missed your first reply's "Re-compilation causes the EA to re-initialize, so your init() function gets invoked. ".

I just realized you answered my question already.

Thanks again!

No problem. Just an issue of timing I think. I posted my response, then decided to immediately edit it to add the explanation about the init() function so you'd get exactly what was happening.


CB

Reason: