A LITTLE HELP NEEDED ON MY EA

 

Am currently building an EA thats base on the ichimoku kinko hyo system i have  manage to code a few lines but am close to no where, cos the EA is incomplete and its giving me errors.

Firstly, am having problem in putting the trailing stop in my code so that once the price hit the take profit it increases in pips specified in the trailing stop and the stop loss reduces in pips too.

secondly, am getting "if' - expressions are not allowed on a global scope" on several lines i have tried everything i know of in MQL4 but it seems its not enough.

thirdly, to those of you that knowns how ichimoku operates, am thinking whether its possible to include the Chikou span strategy - so that if the Chikou span is in price 26 period ago it will wait until its out of price before executing a buy or sell.

finally, guys i really need your help in this please AM STUCK..... 

BELOW IS THE SOURCE CODE FILE.

 
New section was created for the forum for MQL4/MT4 (no any threads yet):

MQL4 and MetaTrader 4

 
so I should post my topic over there
 
Nkechi Sonia Kanu:
so I should post my topic over there

Not a problem for now.

But it will be better to place such a specific 'coding questions' to this section after mql4.com forum will be transferred here.
This section is empty now ... but if you want to be the first one (to open first thread on the section) so you can go it :)

 
hello guys am waiting for ur responds
 
Nkechi Sonia Kanu:
hello guys am waiting for ur responds

As it stands, there is just too much of your code that is plainly wrong! Since this is in regards to MQL4, I suggest that you do the following:

  • First learn the basics of coding (like in "C"). Here are a few links for sites that offer tutorials and learning for "C" that can help:
  • Then read and follow the Book/Tutorial (even though it is old and out of date).
  • At the same time, read the entire documentation with special attention to the MQL4 Updates that are not mentioned in the Book/Tutorial.
  • Then you should study several examples of code for Indicators, Expert Advisors (EAs) and Scripts in the user Code Base.
  • Then you can start making your own, but very simple Indicators and slowly build on them until fully able to understand and make more complex Indicators.
  • Then you can start making your own, but very simple EAs and slowly build on them until fully able to understand and make more complex EAs.

You should not skip any of these necessary steps! Consider this as a very important lesson!

PS! Also, please don't double post. You had already started a thread at https://www.mql5.com/en/forum/99271 with the same topic.
MQL4 Tutorial
MQL4 Tutorial
  • book.mql4.com
MQL4 Tutorial
 
Nkechi Sonia Kanu:

Am currently building an EA thats base on the ichimoku kinko hyo system i have  manage to code a few lines but am close to no where, cos the EA is incomplete and its giving me errors.

Firstly, am having problem in putting the trailing stop in my code so that once the price hit the take profit it increases in pips specified in the trailing stop and the stop loss reduces in pips too.

secondly, am getting "if' - expressions are not allowed on a global scope" on several lines i have tried everything i know of in MQL4 but it seems its not enough.

thirdly, to those of you that knowns how ichimoku operates, am thinking whether its possible to include the Chikou span strategy - so that if the Chikou span is in price 26 period ago it will wait until its out of price before executing a buy or sell.

finally, guys i really need your help in this please AM STUCK..... 

BELOW IS THE SOURCE CODE FILE.

Only cleaned errors.

You need to learn much more MQL4. 

Files:
Reason: