MQL4 - automated forex trading   /  

Code Base

Read Financial Magazines in MetaTrader 4 and MetaTrader 5!

Code Base  Expert Advisors  Open and Close positions using the lines To post a new code, please log in or register

Download MetaTrader 5 and visit Code Base
and Trade on the Go!
and Trade on the Go!
Couldn't find the right code? Order it in the Jobs section

This Expert Advisor is for
MetaTrader 4
Download MT 4 - 455 Kb

and Trade on the Go!

and Trade on the Go!

Open and Close positions using the lines [ ru ]
Author: cmillion (2009.11.23 15:55)
Downloaded: 9547
 SendCloseOrder.mq4 (6.0 Kb) View


The Expert Advisor draws 4 lines: "BUY LINE", "SELL LINE" и and two corresponding "CLOSE" lines.

Your task is to move the lines to the prices you want to operate - to Buy, to Sell, or to Close.

The orders are set and close at the moment then price crossing the line, for example for Buy case: if the Ask price crosses "Buy LINE", and for Sell case if the Bid price crosses "SELL LINE", the same is for "CLOSE" lines.


Here is a trade example at figure

The total number of lines can be reduced using the lines

DRAW_SELL - draw Sell line
DRAW_BUY - draw Buy line
DRAW_CLOSE1 - draw Close1 line
DRAW_CLOSE2 - draw Close2 line

There are some external variables: lot - lot size and order - maximal orders allowed. The CLOSE lines can be used for a trailing stop, just choose right angle.

The Expert Advisor has been created using The signal lines with alert after crossing, you can find my other solutions here. Good Luck!

Editor's remark:

Note that it's a mirror translation of the original Russian version.

If you have any questions to the author, suggestions or comments, it's better to post them there.

If you have found this code useful for trading or educational purposes, don't forget to thank author.

4 comments  To post a new comment, please log in or register

but how to includt it in my trading plateform (meta 4)

13.03.2010 23:40 shakeel353
giaras wrote:

Line "CLOSE " closes position, necessary to allow adviser to trade

09.12.2009 08:09 cmillion

Really interesting your ea.

Just not clear what you mean with "CLOSE line can be used for trailing stop".

There is no evidence about this behavior.

Can you give us some more information ?

Thank your very much for your work.

08.12.2009 21:07 giaras

thank you! I will try this first :)

24.11.2009 22:31 ultimaforex