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.


1 Answer 1


For an simple approximation (which is not particularly useful if you want values to be asymptotically close around $N$),




are suitable. If you want an asymptotic approximation (which is very accurate),


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.

  • $\begingroup$ Thank you very much! Are there any learning resources you can point me to as to how you came about this solution? I don't have a strong math background so even just general categorical subject matter would be helpful. $\endgroup$ Sep 1, 2021 at 17:06
  • 1
    $\begingroup$ No problem. So, $1-e^{-k\left(x-N\right)^{2}}$ is an example of an indicator function (in this case $1$ at all points expect for $0$ at $N$). A general indicator is $\lim_{k\rightarrow\infty}\left(a-\left(a-b\right)e^{-k\left(x-N\right)^{2}}\right)$ ($a$ at all points expect for $b$ at $N$). The first two approximations were sigmoid functions (S shaped). Sigmoid functions come up when doing ODEs and indicators often come up in real world problems (i.e. Dirac delta function in physics). $\endgroup$
    – UNOwen
    Sep 1, 2021 at 17:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.