Your topic has been moved to the section: Expert Advisors and Automated Trading
Please consider which section is most appropriate — https://www.mql5.com/en/forum/172166/page6#comment_49114893
Please consider which section is most appropriate — https://www.mql5.com/en/forum/172166/page6#comment_49114893
Dean: EA code is attached below.
Please attach your source code file with the original and correct file extension. Do not attach it as a ".txt" text file.
Dean:
I created an EA for strategy testing, it has no error or warnings, yet it can't detect Horizontal lines, or Moving Average.
more explanation: the EA is supposed to open a trade when price touch Horizontal lines i draw on the chart, or Moving average.... .
same rpoblem happened when i created an indicator to trigger an alert sound when price touches a Horizonal line.
EA code is attached below.
Your declaration of the moving average indicator is wrong. It should be declared in the Oninit function and accessed using a buffer.
You can find a good example in the mql5 link below to correct any mistakes .
https://www.mql5.com/en/articles/31

MQL5 for Newbies: Guide to Using Technical Indicators in Expert Advisors
- www.mql5.com
In order to obtain values of a built-in or custom indicator in an Expert Advisor, first its handle should be created using the corresponding function. Examples in the article show how to use this or that technical indicator while creating your own programs. The article describes indicators that are built n the MQL5 language. It is intended for those who don't have much experience in the development of trading strategies and offers simple and clear ways of working with indicators using the offered library of functions.

You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
I created an EA for strategy testing, it has no error or warnings, yet it can't detect Horizontal lines, or Moving Average.
more explanation: the EA is supposed to open a trade when price touch Horizontal lines i draw on the chart, or Moving average.... .
same rpoblem happened when i created an indicator to trigger an alert sound when price touches a Horizonal line.
EA code is attached below.