Discussion of article "MQL5 Cookbook: Getting Position Properties"

 

New article MQL5 Cookbook: Getting Position Properties is published:

In this article, we will create a script that gets all position properties and displays them to the user in a dialog box. Upon running the script, you will be able to select out of two modes available in the drop-down list in the external parameters: to either view position properties only on the current symbol or to view position properties on all symbols.

MQL5 Cookbook: Getting Position Properties

Author: Anatoli Kazharski

 

Hi Anatoli,

I only just found these two articles 'cookbook' and am grateful for your efforts.


I have noticed with programs/scripts like this, they do not seem to recognize if there is more than one position on a particular currency pair.


For instance, if I have two positions open on the EURUSD (one sell at 1.2250, and the other sell at 1.2200), then it only recognizes the first one and not the second. I am not sure if this is because something has to tell the program/script that its an account which allows hedging? Do you have any articles that deals with scripts that recognizes multiple positions on the one currency pair?


Many thanks

Dingo

 
Dean Thomas Whittingham:

Hi Anatoli,

I only just found these two articles 'cookbook' and am grateful for your efforts.


I have noticed with programs/scripts like this, they do not seem to recognize if there is more than one position on a particular currency pair.


For instance, if I have two positions open on the EURUSD (one sell at 1.2250, and the other sell at 1.2200), then it only recognizes the first one and not the second. I am not sure if this is because something has to tell the program/script that its an account which allows hedging? Do you have any articles that deals with scripts that recognizes multiple positions on the one currency pair?


Many thanks

Dingo

Hey! 

I know it's been a while since you posted this. Indeed, I think the first method will only pick up the first order in the pos for the given symbol. To read all trades from a specific symbol, you'd need to adapt the second variant to the script (all trades) and just add an if "filter" to where it procedes only if the order symbol is the same as the current given symbol.

Hope it helps.

-Fernando.