Expert Advisor Compilation Errors!

 

Greetings To All

Lately I've been trying to create an Expert Advisor for myself. However while coding for the same; I've been receiving errors which i have failed to understand and rectify as i lack expertise in the language .I've attached the screenshots for the same below.The code has all been attached externally as it is pretty lengthy; so feel free to make the required changes and revert.Although I understand it may not be accurate so if any other errors are noticed please inform me.If someone could provide some tips or be willing to aid in rectification of the code ; It'd be of great help.

Error received : Errors.png
Error 2 : Errors 2.png
Error 3 :Errors 3.png

Thanks!

Files:
Errors_3.png  144 kb
Errors.png  137 kb
Errors_2.png  138 kb
 

Ok so you have 2x OnInit() and 

#property indicator_buffers 2
#property indicator_chart_window

This is for Indicators not for Experts and Indicators can not trade so what is your program suppose to be ? 

You are mixing Indicator code with Expert Advisor code.
 
Marco vd Heijden:

Ok so you have 2x OnInit() and 

This is for Indicators not for Experts and Indicators can not trade so what is your program suppose to be ? 

You are mixing Indicator code with Expert Advisor code.

Am actually trying to include an external indicator to work simultaneously with my EA. 

These codes are for the EA and I' ve included the code to instruct my Advisor to Read signals from my indicator.

The attached file "Indicator Signal" is the Indicator loaded onto a chart.The diamond arrow winding 116 is where I need trade execution with predefined SL and TP.

As per indicator Buy entry color is MediumBlue and Sell Entry color is Crimson.

Files:
 

You can not incorporate indicators like that into an Expert Advisor, you have to either use iCustom or hard code the calculation into the EA.

Documentation on MQL5: Technical Indicators / iCustom
Documentation on MQL5: Technical Indicators / iCustom
  • www.mql5.com
[in]  The name of the custom indicator, with path relative to the root directory of indicators (MQL5/Indicators/). If an indicator is located in a subdirectory, for example, in MQL5/Indicators/ [in] input-parameters of a custom indicator, separated by commas. Type and order of parameters must match. If there is no parameters specified, then...
Files:
Abbas-2.mq4  46 kb
 
Marco vd Heijden:

You can not incorporate indicators like that you have to use iCustom or hard code the calculation into the EA.

I really appreciate your prompt and educative guidance.

I could understand the mistakes in my codes.This will certainly help me in the future.

All the errors were resolved in my code with your help and guidance.

Keep up the good work.

May God bless You.

Live Long and Prosper.

Thanks and Regards.

 
Abbas_Vohra: Am actually trying to include an external indicator to work simultaneously with my EA.

Don't try to do that. There are no buffers, no IndicatorCounted() or prev_calculated. No way to know if older bars have changed or been added (history update.)

Just get the value(s) of the indicator(s) into EA/indicator (using iCustom) and do what you want with it.

You should encapsulate your iCustom calls to make your code self-documenting.
          Detailed explanation of iCustom - MQL4 programming forum #33 2017.05.23