@rafaelgrecco said in How to Select "Least profitable trade"?:
What I was missing was:
Reseting the variable "smallestprofit" on every new loop
We must reset the variables at some point, so the ea don't get "stuck" to some big loss that is already closed. Now it resets the variable on every tick, and also calculates it again so we always have the correct value. It is not the most cpu-optimal way but should work fine.
Using the second output of "Each Trade" to wait for all trades to be checked
I think this is the correct way, we must first check all trades in order to find the lowest profit.
The looping blocks work a bit different than other blocks, go ahead and test different logic builds 🙂