Close the least profitable trade
-
What would be the easiest way to select the single least profitable trade and close it
So lets say I have 5 open trades , all losers and I want to close the absolute biggest loser in pips, and keep the other 4 open
how would I manage that, which blocks should I use?Thanks
-
-
WOW
that is so much easier than actually programming this
I should have found that optionlast question on this subject
when you use terminate, does it actually stop the EA, or just the loop?
or just waits for the next tick or bar to keep on working?hope I make sense
-
This functions is used: http://docs.mql4.com/common/expertremove
-
okay so I should use loop(break) instead I guess
-
I think that you want to have a Script which will close the least profitable trade only when you run it manually. The difference between Expert Advisors and Scripts is that Scripts run only once, they do their job once and then they exit. But you should know that...
Or you want to break the loop (for loops this word is used), which means that you stop the loop in the middle and continue doing the next thing after it. Only for the pink blocks I have added such block and you can find it in the bottom of that category. But if in "For each trade" you have "Not more than n trades" set to 1, it will stop after the first trade in the loop anyway.
-
I imagine when we select profitable last, it selects based on piure dollar values, and not pips, right?
Is it posisble to have a routine that selects based on per pip, not dollars?
Any possibility on adding this?
-
Yes, it looks at the profit in money.
If I ever do something about this, it will be some universal way of sorting, but I'm still not sure how exactly to do it