Long Only or Short Only

 

MT4 offers this setting when attaching the EA to the chart to have Long only or Short only

I cannot find this in MT5. How can I do this in MT5? The only thing I can think of is to program into the EA.

 
anyone?
 
I haven't seen that option in mt5 strategy tester, therefore I'm inclined to say it isn't there. I've used that option maybe twice within mt4, most time, if I want buy_only, I just place op_buy in the ordersend function.
Documentation on MQL5: Trade Functions / OrderSend
Documentation on MQL5: Trade Functions / OrderSend
  • www.mql5.com
Trade Functions / OrderSend - Documentation on MQL5
 
doshur:

MT4 offers this setting when attaching the EA to the chart to have Long only or Short only

I cannot find this in MT5. How can I do this in MT5? The only thing I can think of is to program into the EA.

I would suggest extending the CExpert class and changing the CheckOpen method in order to only check long / short according to a parameter
 
jlwarrior:
I would suggest extending the CExpert class and changing the CheckOpen method in order to only check long / short according to a parameter
How is this related to the topic ?
 
angevoyageur:
How is this related to the topic ?
It's a simple way to implement long only / short only EAs, since the option doesn't seem to be available in mql5 (did I misunderstand the question?)
 

so meaning is confirmed that MT5 do not have this option.

I think I have to declare a custom enum as an input?

where can I read on custom enum? 

 
jlwarrior:
It's a simple way to implement long only / short only EAs, since the option doesn't seem to be available in mql5 (did I misunderstand the question?)
I don't think have any problem with mql5. Of course with mql5 you can send any order you want. He is talking about an option of MT4 terminal which disappears in MT5 terminal. With this option you can have a EA placing only Buy order for example, even if the EA is build to send buy and sell order.
Documentation on MQL5: Standard Constants, Enumerations and Structures / Trade Constants / Trade Orders in DOM
Documentation on MQL5: Standard Constants, Enumerations and Structures / Trade Constants / Trade Orders in DOM
  • www.mql5.com
Standard Constants, Enumerations and Structures / Trade Constants / Trade Orders in DOM - Documentation on MQL5
 
doshur:

so meaning is confirmed that MT5 do not have this option.

I think I have to declare a custom enum as an input?

where can I read on custom enum? 

https://www.mql5.com/en/docs/basis/types/integer/enumeration
Documentation on MQL5: Language Basics / Data Types / Integer Types / Enumerations
Documentation on MQL5: Language Basics / Data Types / Integer Types / Enumerations
  • www.mql5.com
Language Basics / Data Types / Integer Types / Enumerations - Documentation on MQL5
 
doshur:

so meaning is confirmed that MT5 do not have this option.

I think I have to declare a custom enum as an input?

where can I read on custom enum? 

I will try to upload the modified version to the code base

angevoyageur:
I don't think have any problem with mql5. Of course with mql5 you can send any order you want. He is talking about an option of MT4 terminal which disappears in MT5 terminal. With this option you can have a EA placing only Buy order for example, even if the EA is build to send buy and sell order.

 That's what I was talking about, a way to modify the default implementation in order to provide that option

 
jlwarrior:

I will try to upload the modified version to the code base

 That's what I was talking about, a way to modify the default implementation in order to provide that option

It's absolutely not the same thing. With MT5, each EA has to implement his own method to buy only or sell only. Of course you can provide your own implementation by extending standard class.
Create your own Market Watch using the Standard Library Classes
Create your own Market Watch using the Standard Library Classes
  • 2010.12.28
  • Dmitriy Skub
  • www.mql5.com
The new MetaTrader 5 client terminal and the MQL5 Language provides new opportunities for presenting visual information to the trader. In this article, we propose a universal and extensible set of classes, which handles all the work of organizing displaying of the arbitrary text information on the chart. The example of Market Watch indicator is presented.