How can I close an opened position if a statement is true...

 

Hi,

I have an EA. The EA can open orders according to some rules. It can set a take profit and stop loss point.

if my statement is true, the EA should not wait to stop loss and close the order. Forexample, if SMA(15)>SMA(50) for a sell position.

I read PositionClose but there is not an example. Can you help me please?

Best,

Murat Y. 

 
OrderClose - Trade Functions - MQL4 Reference
OrderClose - Trade Functions - MQL4 Reference
  • docs.mql4.com
OrderClose - Trade Functions - MQL4 Reference
 

Thank you!!

Reason: