fascinating code Mat!

as to the formula for ReR I was curious and did some math.

It turns out that ReR is the expected gain normalized over the expected loss.

Code:
RER = E[Gain]/E[Loss]

where 

 E[Gain] = E[Win] - E[Loss] 


 E[Win]  = <Win> * p(win) (read: 'expected win = average win * prob win)
 E[Loss] = <Loss> * p(loss)


then <win>, <loss> and p(win) are estimated using the previous N trades.
Assuming for simplicity <Win> and <Loss> are constants, then ReR uses the outcome of the previous N trades to estimate probability of win over the next trade.

Using the last N trades to estimate the prob win of the next one does not seem particularly innovative, but I find interesting that the figure of merit (ReR) normalizes the Expected Gain (W-L) to the Expected Loss (L) as it allows to weight the potential benefit to the risk.

It is similar to normalizing the average/mean to the variance I guess.

To reap the benefit of such normalization one should use a threshold Th > 0. Setting Th = 0 eliminates the normalization.

very well done Mat. Ciao wink

Last edited by luisd; 04/15/18 12:08.