Download MetaTrader 5

Long Only or Short Only

To add comments, please log in or register
Start making profit using the Market. Publish your product!
Dua Yong Rew
5422
Dua Yong Rew 2013.10.17 04:26 

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.

Dua Yong Rew
5422
Dua Yong Rew 2013.10.17 10:54  
anyone?
Ubzen
5394
Ubzen 2013.10.17 12:49  
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
Jose
282
Jose 2013.10.17 13:22  
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
Alain Verleyen
Moderator
30713
Alain Verleyen 2013.10.17 13:30  
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 ?
Jose
282
Jose 2013.10.17 13:42  
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?)
Dua Yong Rew
5422
Dua Yong Rew 2013.10.17 13:47  

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? 

Alain Verleyen
Moderator
30713
Alain Verleyen 2013.10.17 13:48  
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
Alain Verleyen
Moderator
30713
Alain Verleyen 2013.10.17 13:50  
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
Jose
282
Jose 2013.10.17 16:27  
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

Alain Verleyen
Moderator
30713
Alain Verleyen 2013.10.17 16:39  
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.
12
To add comments, please log in or register