position open price and stop loss as result of many orders opened at different times

To add comments, please log in or register
michelino
223
michelino  

Hi,

I'm building some simple EA to learn mql5.

I cannot understand how MetaTrader behaves after a series of orders like the following:

CTrade         m_trade;

....
....

m_trade.Buy(0.1,m_symbol.Name(),m_symbol.Ask(),100,0,TradeComment) //price of symbol is 105

m_trade.Buy(0.1,m_symbol.Name(),m_symbol.Ask(),110,0,TradeComment) //price of symbol is 115

m_trade.Buy(0.1,m_symbol.Name(),m_symbol.Ask(),120,0,TradeComment) //price of symbol is 125

basically the EA starts three buys in 3 different days with different market price and so different stoplosses; whats the behaviour?

when price falls back to 115 just 0.1 lots are sold?

or the whole position of 0.3 lots is going to have an average buy price of 115 and an average stoploss of 110?

or other things happens?

thanks in advance

M.

To add comments, please log in or register