Orders not opening as expected - page 2

 
Fernando Carreiro:

After analysing it, I can say this ... it has errors and it won't even compile! Did you post the code correctly?

Take for example the following:

If you run it through the styler, you can clearly see that it is missing a bracket for the condition:

So, please fix up the compile errors first and make sure to fix the warnings too, then retest it and post it here again, if you are still running into problems.

EDIT: You are also using very old type MQL4 code which may even be obsolete in some cases. Try to code in proper modern MQL4+ code and use proper styling. Use the built-in styler if you have to.

Thanks Fernando, strange, it does compile correctly for me, I just tried it again, maybe I missed something when posting the code.

 
Fernando Carreiro:

Also, structure your code in a more organised way. Your code is much too "stringy", making it difficult to read as well as to analyse and spot the problems.

Don't write such long lines.

No need to repeatedly call functions when the value never changes between calls. Save the results as variables. Break it down and organise the logic so that will be easier to read and and spot the problems.

I see, this was adapted from another code, yes it probably could do with being more concise in places