#include <Trade\Trade.mqh>
CTrade ctrade;
ctrade.PositionClose(
const string symbol,
ulong deviation=ULONG_MAX
);
//or by ticket
ctrade.PositionClose(
const ulong ticket,
ulong deviation=ULONG_MAX
);
CTrade ctrade;
ctrade.PositionClose(
const string symbol,
ulong deviation=ULONG_MAX
);
//or by ticket
ctrade.PositionClose(
const ulong ticket,
ulong deviation=ULONG_MAX
);
Gruwel:
...
...
In MT4 it was easy with the ClosePosition () function, but MT5 works differently.
Please help.
There is no ClosePosition() on "MT4".
Your question is about mql4 or mql5 ?
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Hi All
Apologies if this has been answered before, but I can't find a suitable answer.
How do I close an open position when certain criteria are met?
For example:
if(fast moving average crosses over and above slow moving average)
Open long position
if(fast moving average crosses over and below slow moving average)
Close the open (long) position <== This is the part I can't do.
In MT4 it was easy with the ClosePosition () function, but MT5 works differently.
Please help.