Expert advisor automatically buy/sell mechanism

Back to topics list To post a new topic, please log in or register
nguye235 2014.03.23 06: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.

GumRai 2014.03.23 07:15 #

From the book

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

Back to topics list  

To add comments, please log in or register