There are just too many things wrong with it. You are mixing elements of an Indicator (to display on a chart) together with an Expert Advisor (for trading).
The OnCalculate() event handler is for Indicators, but indicators cannot use trading functions like OrderSend(). You also have an "if" in front of "OnCalculate()". Maybe you meant to write "int" instead of "if".
If it is an Expert Advisor for trading then you can't use OnCalculate(). Instead you need to use OnTick().
There are also unbalanced parenthesis in your code and code that is outside of a function in the global scope where it is not allowed.
I do suggest you return to the documentation and read some more. Have a look at examples in the CodeBase to help you out.
There are just too many things wrong with it. You are mixing elements of an Indicator (to display on a chart) together with an Expert Advisor (for trading).
The OnCalculate() event handler is for Indicators, but indicators cannot use trading functions like OrderSend(). You also have an "if" in front of "OnCalculate()". Maybe you meant to write "int" instead of "if".
If it is an Expert Advisor for trading then you can't use OnCalculate(). Instead you need to use OnTick().
There are also unbalanced parenthesis in your code and code that is outside of a function in the global scope where it is not allowed.
I do suggest you return to the documentation and read some more. Have a look at examples in the CodeBase to help you out.
Sorry, but as I wrote, there is just too much wrong with it. There is even code there that is not even from the MQL language and a whole lot of input parameters that have simply not even been defined.
It would need to be rewritten from scratch and we don't even know the intended strategy logic and the functionality requirements.
If your priority is to get the EA done quickly and not so much learning how to do it yourself, then consider placing a job request in the Freelance section and hiring someone to code it for you.
If however, your priority is learning to code it yourself, then you will have to persevere and continue to do your research and studying other code examples in the CodeBase section, or by reading some Articles aimed at beginner coders.
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
but on keep getting these errors. (check picture below) I do not know how to fix this to make the code functional and able to compile