Better might be this psuedocode, run when there is an execution update.
and the last trade was a loss
update an accumulator
else reset the accumulator to zero.
Not to talk down at you, but as usual, when we first write down the technical spec. of what we want to do, the coding becomes almost trivial.
Leave a comment: