winrate = wins / (wins + losses)
I fiddled around with it and found that:
requiredWinrate = risk / (reward + risk)
expectancy = (winProbability x averageWin) - (lossProbability x averageLoss)
So I reasoned that maybe
expectancy = (winrate x reward) - ((1-winrate) x risk)
Now I have two problems with this formula. One is I cannot be sure that it's correct and two is I cannot figure out how to solve for winrate or how to solve for (reward/risk).
In forex trade I may have a potential trade with given reward and risk values and given win rate in which case I would want to calculate expectancy to know if it has positive or negative expectancy. But I would also like to know what winrate I need in for given reward and risk values and positive expectancy in cases where I do not have a known winrate but can make a reasonable decision if I can calculate the required win rate.
Edit: I've confirmed that the formula is correct with a python script that simulates trades on a given winrate and compares a calculated expectancy and computed expectancy. https://pastebin.com/8FF1vAMm