Download MetaTrader 5
To add comments, please log in or register
Find out how to add a video in the messages editor
Minh 2014.03.23 05:14 
Hi guys. Can you guys teach me how to properly write a EA? From my understanding, EA similar to an indicator but it can automatically do the trading for you.
What I got so far from and from google is:

To open a new order we do:

   int ticket=OrderSend(Symbol(),OP_BUY,vol,pri,slippage,stoploss,takeprofit,"comment",magicnumber,0,CLR_NONE);

This command mean that the system will automatically buy volume "vol" for the current symbol at
price "pri" right?
So what is the slippage (5th parameter) used for?

What happen when the price hit "stoploss"/"takeprofit", is the system going to automatically close the order when it hit this price?
or do I have to use the OrderSelect() and then OrderClose() to manually close them all?

Please give me some insight.

Keith Watford
Keith Watford 2014.03.23 06:15  

From the book

it allows a bit of leeway as the price may have changed slightly since you received the price

To add comments, please log in or register