Smoothing a Long–Short Return Signal at Its Equilibrium
Summary
The question considers a trading range with an equilibrium price where the maximum gains from long and short positions balance. It proposes using the long-side expected log return above equilibrium, the short-side return below it, and zero at equilibrium, but notes that this piecewise rule jumps sharply near the switching point.
The answer suggests smooth transition functions based on the hyperbolic tangent or error function, scaled by a log-return magnitude and centered at equilibrium. It also gives a limiting construction that is zero exactly at equilibrium and approaches a fixed return elsewhere; large values of its tuning parameter make the transition narrow. These are mathematical approximations rather than a validated trading signal: the document provides no empirical tests, parameter-selection guidance, or comparison of forecast performance. The formula choices therefore address continuity, but do not establish that any particular curve is appropriate for a real market or that the resulting values are calibrated expected returns.
Key ideas
- A piecewise long–short return rule can create an unrealistic jump at the equilibrium price.
- A hyperbolic tangent or error function can provide a smooth transition centered on equilibrium.
- The transition steepness is controlled by a parameter that determines how quickly the function changes around equilibrium.
- A limiting construction can be zero at equilibrium while approaching a fixed return elsewhere, but it does not validate the signal empirically.
Tags
Full text
# Combining discontinuous opposing returns into a single continuous function
# Combining discontinuous opposing returns into a single continuous function
See the function here.
It's my intent to measure the expected log return of the optimal trade with regards to long/short positions in a trading range. The trading range has an equilibrium where the maximal gains of the long position equate to the maximal gains of a short position which results in neither side gaining any ground. If the close price is greater than the equilibrium, use the long position as a measure of expected future returns. If it's less than the equilibrium, use the short position. If it's equal, 0.
Currently the way I've structured things, this is a discontinuous function with strong jumps around 0 which doesn't make any real world sense to me. I would rather like to see some sort of smooth transition between 0 and the regime change. I just don't know how to go about doing that. I'm also unsure if a linear mapping is reasonable or if some sort of curve/distribution would make more sense and why.
## Answer by UNOwen (score 0, accepted)
https://quant.stackexchange.com/a/66722
For an simple approximation (which is not particularly useful if you want values to be asymptotically close around $N$),
$$\ln\left(\frac{\max\left(L,H\right)}{0.01}\right)\tanh\left(k\left(x-N\right)\right)$$
or
$$\ln\left(\frac{\max\left(L,H\right)}{0.01}\right)\operatorname{erf}\left(k\left(x-N\right)\right)$$
are suitable. If you want an asymptotic approximation (which is very accurate),
$$R_{N}=\lim_{k\rightarrow\infty}R_{O}\left(1-e^{-k\left(x-N\right)^{2}}\right)$$
such that $R_N=R_O$, $\forall x\in\mathbb{R}\backslash\{N\}$ and $R_N=0$ when $x=N$. Taking large values of $k$, yields a continuous solution. See https://www.desmos.com/calculator/45djjacr1i. I hope this helps.Shown in full with attribution under the source's licence. Licence: CC BY-SA 4.0 (Stack Exchange)
This summary was written by Stratmill's research agent from the original; it is not a copy of the source.