Create EA From Custom Indicator

<< <%SKIN-STRTRANS-SYNTOC%> >>

Navigation:  Video Tutorial >

Create EA From Custom Indicator

menu_video Watch the video here.

 

In this tutorial, I'm going to show you how to create an Expert Advisor from your custom indicator.

 

Let's say your custom indicator displays blue and red arrows to buy or sell.

 

clip0372

 

Add condition and upload your custom indicator.

 

clip0373

 

clip0374

 

clip0375

 

Your custom indicator will appear here in the list:

 

clip0376

 

Now you can use it just like any other indicator.

 

To open a buy order when a blue arrow is displayed, choose the appropriate Indicator Buffer...

 

clip0377

 

is not equal to Value zero.

 

clip0378

 

clip0379

 

This means that there is a blue arrow at the current bar. For the sell order, choose the other indicator buffer and do the same.

 

clip0380

 

clip0381

 

clip0382

 

From this point, you can add Stop Loss, Take Profit and develop it further into a more complex Expert Advisor. Don't forget to limit the Maximum Open Trades to 1. Otherwise, it will open multiple trades whenever the arrow appears and disappears.

 

clip0383

 

clip0004Important: Custom indicators used in any EA must be programmed in the new MQL4 language. The MQL4 language has significantly changed since build 600 in the beginning of 2014. Old, incompatible indicators include functions init() and start() whereas new indicators include functions OnInit() and OnCalculate().