Positions parameter - Common Tab EA

 

Hi,

So I'd like to get the value of Only Shorts, Only Longs, Both on my script. This will help me a lot to take decisions on my EA.

I've tried the SYMBOL_TRADE_MODE but it says it's FULL_MODE not the current mode.

Does anyone would like to help me?

Thanks in advance!

MQL4

 
Your topic has been moved to the section: MQL4 and MetaTrader 4
Please consider which section is most appropriate — https://www.mql5.com/en/forum/172166/page6#comment_49114893
 
Daniel Alarcon: So I'd like to get the value of Only Shorts, Only Longs, Both on my script. This will help me a lot to take decisions on my EA. I've tried the SYMBOL_TRADE_MODE but it says it's FULL_MODE not the current mode.

Does anyone would like to help me?

As far as I know, that is not reported in any of the internal MQL properties available to the program.
 
Fernando Carreiro #:
As far as I know, that is not reported in any of the internal MQL properties available to the program.
Thanks for replying! Appreciate it
 
Is there a not conventional way to check this? Maybe trying to open an order and if it fails with an specific OP_TYPE it's because it's only long or only short?
 
Daniel Alarcon #: Is there a not conventional way to check this? Maybe trying to open an order and if it fails with an specific OP_TYPE it's because it's only long or only short?

Yes, that is certainly a plausible work-around.

However, why not simply have a EA parameter to select "Long/Short/Both", instead of having to rely on the "Common" tab?

 
Fernando Carreiro #:

Yes, that is certainly a plausible work-around.

However, why not simply have a EA parameter to select "Long/Short/Both", instead of having to rely on the "Common" tab?

Yes but wanted to use native MT4 parameters, but ya, don't want to waste more time on this. Thanks again!