The Sharpe ratio was initially devised by William Sharpe to compare the returns of mutual funds by removing the volatility from the picture. Since then, people have used the Sharpe ratio on everything that has a return, including trading systems, regardless of whether they trade daily, or once in a while. Trading frequency, position sizing, and the quality of your entries and exits all factor in to get you a Sharpe, and you need to treat everything the same way.
In other words, the sharpe ratio provides a way to normalize returns to make it easier to compare them.
Your case is no different, you need to calculate your return on a regular basis (daily, weekly, monthly, or yearly) by valuing your portfolio at the end of each period (cash + securities), and if you are not in a trade, the return will be 0 for that time period (or whatever interest you may get on your cash).
Once you have the returns on a regular basis, you can then calculate the standard deviation of the returns, annualize it, and divide this into the yearly return to get your sharpe ratio (or at least, the 2 values need to be over the same period, i.e. annual return divided by annual standard deviation).
The sharpe ratio is typically calculated using the excess return over the risk free rate, although nowadays, 0 sounds about right, so you can ignore.