How to close lowest position - page 2

 
Kareem Abdelhakim:
Create 2 arrays one that will hold positions tickets of long type and another one of double type that will hold positions profit , you just need to loop through all positions and insert tkt and position profit into the respective array in every iteration . Then using ArrayMin function pass the profits array to it it will return the index of lowest profit in the array . Use this index and select the item in the tickets array using the same index then close the position that has this index
Or you can use 2dimensions array with 1st dimension will hold profits and 2nd will hold positions tickets then apply the ArrayMin function just like previously explained

Hi Kareem,


Thank you for this suggestion; I thought about something like that but technicaly i don't know how to code it.
If you can post me some sample of code i should greatly appreciated.

Reason: