Two things i noticed;
If you are looking for your EA to go through all the open trades in modifyTrade function, you should maybe try someting like this:
for (int z= OrdersTotal()-1; z>=0; z--)
Your OrderSelect seems to be missing the MODE_TRADES or MODE_HISTORY, so it should be like this:
OrderSelect(z, SELECT_BY_POS, MODE_TRADES)
Hope this helps.
I have this code below which I am using to test trailing stop function. It works on some currency pairs and doesn't work in others. It's returning error code 0 (zero).
I will be grateful if somebody can help me out.