Trendline Breakout Automated Entry

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

Navigation:  Video Tutorial >

Trendline Breakout Automated Entry

menu_video Watch the video here.

 

In this tutorial, we're going to create a very useful Expert Advisor. It will buy or sell when the price breaks through a trendline that is drawn in the chart.

 

clip0349

 

Add condition: Price, crosses above, Upper Trendline.

 

clip0350

 

Set Stop Loss...

 

clip0351

 

...it will be added to Inputs.

 

clip0352

 

clip0353

 

clip0354

 

clip0355

 

Set Take Profit the same way.

 

clip0356

 

clip0357

 

clip0358

 

And create the opposite conditions for sell order.

 

clip0359

 

When the Price crosses below the Lower Trendline, a sell order will be opened.

We have to limit the number of open trades to 1 to prevent multiple orders when the price is oscillating around the trendline.

 

clip0360

 

The Money Management is Fixed.

 

clip0361

 

We can set up audible alerts for each order.

 

clip0362

 

Here we see we have created two inputs – the Stop Loss and Take Profit:

 

clip0363

 

And we will also add the Trade Size, so we have three inputs altogether.

 

Copy the source and compile it.

 

clip0364

 

clip0365

 

clip0366

 

Let's try it. Draw two trendlines or horizontal lines in the chart forming a triangle pattern.

 

clip0367

 

Attach the Expert Advisor to the chart.

 

clip0368

 

clip0369

 

clip0370

 

As soon as the price breaks through one of the trendlines, the order is executed.

 

clip0371