ENUM_POSITION_REASON REASON = (ENUM_POSITION_REASON)PositionGetInteger(POSITION_REASON); if(REASON==POSITION_REASON_CLIENT) { // probably (or definitely?) placed manually. (need confirmation) } else if(REASON==POSITION_REASON_EXPERT) { // made by an EA } else if(REASON==POSITION_REASON_MOBILE) { // bla bla bla } else if(REASON==POSITION_REASON_WEB) { // bla bla bla }
find your position among open ones (if it's currently open, aka not in history) , and select it, then :
Thanks for your reply...
All of my positions are showing CLIENT, even the Manual orders ... I need to know which is MANUAL if that is available.
Thanks for your reply...
All of my positions are showing CLIENT, even the Manual orders ... I need to know which is MANUAL if that is available.
told you, CLIENTs are manually placed orders.
That's not exact. A manually placed position (or order) is all what is not POSITION_REASON_EXPERT.
long REASON = PositionGetInteger(POSITION_REASON); if(REASON!=POSITION_REASON_EXPERT) { //--- Manually opened position }As a manual position can be open with the desktop Terminal, mobile Terminal or Web application.
That's not exact. A manually placed position (or order) is all what is not POSITION_REASON_EXPERT.
As a manual position can be open with the desktop Terminal, mobile Terminal or Web application.Alain, I am getting a 0 for both the manual and the EA order. Where are the ENUMs set up so I can see what values are for the POSITION_REASON?
Show your code if you need coding help.
long enumReason = PositionGetInteger(POSITION_REASON);
if (enumReason !=POSITION_REASON_EXPERT)
{
Print(my4CastObj.GetSymbol(),": Trade was made outside of Expert Advisor");
Alert(my4CastObj.GetSymbol(),": Trade was made outside of Expert Advisor");
}
Thanks all for helping with this. I found my issue. I wasn't placing this in the OnTick() subroutine and I wasn't selecting the position when running this.
It is now working like a champ!!
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hello, I am new to MQL5 and I was trying to determine from an open trade how it was placed.
Below is a screen shot of what I am looking for. I cannot locate in any of the ENUMs for a trade or position.
Any help would be greatly appreciated.