How to use OrderSend to send and modify orders?

 

Hi,

I'm studying how to implement EA with MQL4 to trade Forex with Meta Tader 4.

My broker is ActivTrades.

I could not understand very well how to use the OrderSend function.

EA will need to send market orders with Stop Loss and Take Profit.
Stop Loss, Take Profit and Volume will be in the double type variables, with values calculated by EA.

I did some testing and sometimes did not work.

I have to take some additional precautions to use OrderSend function?

Also, depending on what happens with the price, the EA should modify the Stop Loss and Take Profit of the original order. How to do this?

Thanks : )