Can someone help with error codes; expressions not allowed on global scope, function already defined? Thank you for your time.
Please look at the attached file for full code.
42 int start(){ Unbalanced parenthesis error is on this line
321 /+------------------------------------------------------------------+ Unexpected end of program error is on this line
First, add two closing braces "}" to the end of the code; that will alleviate the unbalanced parenthesis and unexpected end of program errors.... and leave you with over 100 other compilation errors to deal with!
My two cents on this code:
1. It's all one function dumped into the start(). Break your code up into logical sections/functions/sub-routines.
2. Instead of massively long if() functions, consider using returns/continues/breaks
e.g.
//Instead of int start (){ if (Bars>BarsCount) { //lots of code here //... //.. // you have to remember that you're inside an if() here } // end if() } //end start() //try something like int start (){ if (Bars<=BarsCount) { return 0; } // the rest of your code can go here // it's a lot easier to read and debug } // end start()
3. Lot's has been written already why you shouldn't use Bars to trigger action on new bars.
You've got some work ahead of you to clean up this... good luck.
-
Always use strict. Fixing the warnings will save you hours of debugging, but you must understand the differences.
-
You should stop using the old event handlers and IndicatorCounted() and start using new event handlers.
Event Handling Functions - MQL4 Reference
How to do your lookbacks correctly - MQL4 programming forum #9-14 & #19 2016.05.11
Please look at the attached file for full code.
****
Do not double post!
I have deleted your duplicated topic.
Please edit your post and use the code button (Alt+S) when pasting code.
EDIT your original post, please do not just post the code correctly in a new post.
Do not double post!
I have deleted your duplicated topic.
Please edit your post and use the code button (Alt+S) when pasting code.
EDIT your original post, please do not just post the code correctly in a new post.
alright, thanks.
First, add two closing braces "}" to the end of the code; that will alleviate the unbalanced parenthesis and unexpected end of program errors.... and leave you with over 100 other compilation errors to deal with!
My two cents on this code:
1. It's all one function dumped into the start(). Break your code up into logical sections/functions/sub-routines.
2. Instead of massively long if() functions, consider using returns/continues/breaks
e.g.
3. Lot's has been written already why you shouldn't use Bars to trigger action on new bars.
You've got some work ahead of you to clean up this... good luck.
-
Always use strict. Fixing the warnings will save you hours of debugging, but you must understand the differences.
-
You should stop using the old event handlers and IndicatorCounted() and start using new event handlers.
Event Handling Functions - MQL4 Reference
How to do your lookbacks correctly - MQL4 programming forum #9-14 & #19 2016.05.11
Changes have been made, thank you; however errors are still being displayed. Anyone available to help with next steps.
Changes have been made, thank you; however errors are still being displayed. Anyone available to help with next steps.
What’s going on with the OnDeinit() function?
What’s going on with the OnDeinit() function?
you care to elaborate on what you mean specifically?
What are the next two lines? Specifically, the lone closing brace?
You seem to struggle with balancing your code blocks { }.
I suggest to take a basic programming course before going on. Start with Java, the syntax is quite similar. There's also a free MQL course at Udemy but I lost the source, look it up yourself.
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Please look at the attached file for full code.
****