Order type for closing long position is ORDER_TYPE_SELL
Order type for closing short position is ORDER_TYPE_BUY
- www.mql5.com
Order type for closing long position is ORDER_TYPE_SELL
Order type for closing short position is ORDER_TYPE_BUY
Incomplete answer.
ORDER_TYPE_SELL is for opening short position or closing long position.
ORDER_TYPE_BUY is for opening long position or closing short position.
Incomplete answer.
ORDER_TYPE_SELL is for opening short position or closing long position.
ORDER_TYPE_BUY is for opening long position or closing short position.
Thank you, guys!
I started to develop EAs using what I have learned in the article: https://www.mql5.com/en/articles/100 , (I think it is very well written and didatic) and modifying that code. In that article, the author didnt use closing long and short positions, instead he used stoploss and take profit. How do you deal with that? Im thinking to try something like:
-define conditions for enter long, close long, enter short and close short positions;
-check if is there is a long or short position opened;
-if there isnt, then check enter long and enter short conditions (sending the corresponding orders to buy or sell short - ORDER_TYPE_SELL or ORDER_TYPE_BUY, case either is true);
-else if there is a long position opened, then check for close long conditions (sending the order to close long position - ORDER_TYPE_SELL -, case true);
-else if there is a short position opened, then check for close short conditions (sending the order to close short position - ORDER_TYPE_BUY - , case true);
- 2010.06.09
- Samuel
- www.mql5.com
Thank you, guys!
I started to develop EAs using what I have learned in the article: https://www.mql5.com/en/articles/100 , (I think it is very well written and didatic) and modifying that code. In that article, the author didnt use closing long and short positions, instead he used stoploss and take profit. How do you deal with that? Im thinking to try something like:
-define conditions for enter long, close long, enter short and close short positions;
-check if is there is a long or short position opened;
-if there isnt, then check enter long and enter short conditions (sending the corresponding orders to buy or sell short - ORDER_TYPE_SELL or ORDER_TYPE_BUY, case either is true);
-else if there is a long position opened, then check for close long conditions (sending the order to close long position - ORDER_TYPE_SELL -, case true);
-else if there is a short position opened, then check for close short conditions (sending the order to close short position - ORDER_TYPE_BUY - , case true);
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hi!
Im new in the MQL world, with little knowledge of C# only...
Looking at the Order Types (in: https://www.mql5.com/en/docs/constants/tradingconstants/orderproperties#enum_order_type), I had a doubt. Is there a order type for closing long positions?
As I understood the ORDER_TYPE_SELL is for selling short, isnt it?
Bruno