Using only weighings with one coin on each side, one can prove that the ordering can be determined with seven weighings:
Weigh coins $A$ versus $B$, then $C$ versus $D$, and then the heavier in each pair against each other. We can re-label the heaviest found as $D$, its original partner as $C$, and the loser of the "weigh-off" as $B$. These three weighings have led knowledge that $D>B>A$ and $D>C$.
Next weigh the coin $E$ (which has thus far not been touched) against $B$,
and then against $D$ if $E>B$, or against $A$ if $E<B$. These fourth and fifth weighings tell you the exact order of $D, E, B$ and $A$. For example, you might find that $D>B>A>E$. It does not matter which of the possibilities you find; the important facts are that you know the order and that the second lightest and the lightest are not $D$.
For the sixth weighing, weigh coin $C$ against the second lightest of the other coins. In our example, we would weigh $C$ versus $A$. Then the only doubt left is the relative weight of $C$ and just one other coin. In our example, if $C>A$ then we can complete the full ordering by weighing $C$ versus $B$ because we already know that $D>C$.
Thus the seventh weighing determines the complete order.
The way to figure this out was:
Without loss of generality, one can assume that the first weighing tells you that coin $B$ is heavier than coin $A$ (written as $B>A$). Then there are only two classes of choices of next weighings:
(1) Weigh coin $C$ against coin $A$ (or any equivalent weighing against an already-weighed coin): Here, a possible result is $C>A$ which leaves 40 allowed orders. Since each weighing provides only one bit of information, discerning among $40$ orders requires at least six weighings, for a total of eight.
(2) Weigh coin $C$ against coin $D$ (or any equivalent weighing of two not-yet-weighed coins): Then there are three classs of next weighing choices available.
(2a) If the third weighing is $E$ versus $D$ (or any of the already-weighed coins) then one possibility says that $E<D$, which leaves $20$ allowed orders, requiring at least $5$ further weighings, for a total of eight.
(2b) If the third weighing is $D$ versus $A$ (or equivalently $B$ versus $C$) then the answer $D>A$ leaves $25$ possible orderings (slotting $E$ into any of $5$ positions, with the first four ordered $DCBA, DBCA, DBAC, BDAC$ or $BDCA$)
which again requires at least $5$ further weighings, for a total of at least eight.
(2c) If the third weighing is $D$ versus $B$ (or equivalently $A$ versus $C$)
then the answer must be equivalent to $D>B$. So $D>B>A$ and you can slot $C$ into any of three positions (but not into $C>D$) and then $E$ into any of $5$ positions. With $15$ allowed possibilities, it might still be possible to discern the ordering in only four more weighings.
So assume we have (in three weighings) $D>B>A$ and $D>C$. The next weighing needs to involve coin $E$ because if we weigh $C$ against $B$ or $A$ there will be some chance of leaving two remaining positions possible for $C$, thus two times five remaining allowed orderings, which cannot be disambiguated in only three further weighings.
3a) Say the next choice (the 4th weighing) is to weigh $E$ versus $B$ (this is the obvious one to try because $D>B>A$). Then if we find $E<B$ we will end up knowing that $D>B>E>A$ or $D>B>A>E$. We spend our fifth weighing on $A$ versus $E$ to fully order those four. Since we know $D>C$ we can now find where $C$ belongs in only two more weighings (starting from weighing $C$ against the second lightest of the others), for a total of seven weighings.
Similarly, if we find $E>B$ we will end up knowing that $D>E>B>A$ or $E>D>B>A$.
We spend our fifth weighing on $D$ versus $E$ to fully order those four. And again we can properly place $$ in two more wiehings, for a total of seven.
(3b) If the fourth weighing were to be $E$ versus $A$ or $E$ versus $D$, then we would require eight weighings in the end.
I did not check the solution for the classic $12$ balls version here. But if it works, it trivially leads to a $4$ weighing solution for the $18$ balls case.
Really, given the classic, there is very little extra work to do!
First you weigh $3A$ vs $3B$. If they are unbalanced, say $3A > 3B$, you can find out with $3A$ vs $3C$ (all $3C$ are good) whether the bad ball is heavier or lighter. Then surely you can find the culprit among a group of $3$ with just one more weighing. Total $3$ weighings.
And if $3A = 3B$, then you are reduced to the classic $12$-ball problem which can be solved with $3$ additional weighings, for a total of $4$.
Further thoughts: In fact, $4$ weighings can solve $30$ balls, not just $18$.
In the above, the $3A \neq 3B$ branch always leads to $3$ total weighings, which is wasteful. Imagine you have $9+9+12 = 30$ balls. The first weighing can be $9A$ vs $9B$. If they are unbalanced, again a second $9A$ vs $9C$ (all good) will tell you if the bad one is heavy or light, and then you can use $2$ more weighings to find the culprit among $9$ (tri-nary search), for a total of $4$ weighings.
Even further, years ago I solved a case (an extension to the classic) where $13$ balls (unknown heavy/light) can be solved with $3$ weighings, provided you have access to extra balls known to be good -- IIRC you need $2$ such good extras. This means $9+9+13 = 31$ can be solved with $4$ weighings, coz in the $9A=9B$ case you are indeed left with $13$ suspects but many extra balls known to be good.
I suspect even $31$ is not the limit (for $4$ weighings). When you weigh $9A$ vs $9C$, only two outcomes can happen (since $9A > 9B$). This is very inefficient and further exploitation might be possible...
You probably know the classic bound that with $n$ weighings there are only $3^n$ possible results, so with $n=4, 3^n = 81$, you cannot solve $\ge 41$ balls ($\ge 82$ outcomes). I'm not saying $40$ is achievable, but there is a wide gap between $31$ and $40$...
Best Answer
This looks like a generalization of the classic $12$ ball problem.
You should be able to modify Jack Wert's wonderful algorithm, (which was designed for the case when $N= \dfrac{3^m - 3}{2}$) to work for any $N$. I believe I had made an (incomplete) attempt when someone asked this on stackoverflow.
Note that the numbers $\dfrac{3^m - 3}{2}$ are special, in the sense that they are the turning points.
In the variant of the problem where you are also required to tell if the odd sphere is heavier or lighter, for $\dfrac{3^m -3}{2} \lt N \le \dfrac{3^{m+1}-1}{2}$, the optimal number of weighings can be shown to be $m+1$.
If you are only required to find the odd sphere and not necessarily figure out if it is heavier or lighter, the turning points are $\dfrac{3^m -3}{2} + 1$.