Hello All,
I'm having real difficulty trying to resolve this coding problem and would welcome any advice:
I want to loop through all my open trades, arrange them in order depending on how much open profit/loss each one has and then output the ticket number for the trade that has the least amount of profit but ignoring those trades which are currently sitting on a loss.
As an example, say I have 6 open trades as follows:
(Ticket Number | Trade Type | Amount of current Profit/Loss $
Ticket 001 | BUY | $ 54
Ticket 002 | SELL | - $25
Ticket 003 | BUY | $ 4
Ticket 004 | SELL | $84
Ticket 005 | BUY | - $10
Ticket 006 | BUY | $ 154
Based on the above, the ticket number that I would want would be Ticket 003.
Any Ideas on how to achieve this? I know that I will need to create an Array but I'm struggling to know what to code.
Any help, as always, appreciated.
Chorlton
I'm having real difficulty trying to resolve this coding problem and would welcome any advice:
I want to loop through all my open trades, arrange them in order depending on how much open profit/loss each one has and then output the ticket number for the trade that has the least amount of profit but ignoring those trades which are currently sitting on a loss.
As an example, say I have 6 open trades as follows:
(Ticket Number | Trade Type | Amount of current Profit/Loss $
Ticket 001 | BUY | $ 54
Ticket 002 | SELL | - $25
Ticket 003 | BUY | $ 4
Ticket 004 | SELL | $84
Ticket 005 | BUY | - $10
Ticket 006 | BUY | $ 154
Based on the above, the ticket number that I would want would be Ticket 003.
Any Ideas on how to achieve this? I know that I will need to create an Array but I'm struggling to know what to code.
Any help, as always, appreciated.
Chorlton