StockFetcher Forums · Filter Exchange · Position Sizing and Stop - Non-Linear 3rd Order Polynomial<< >>Post Follow-up
stocktrader
294 posts
msg #63462
Ignore stocktrader
6/6/2008 11:40:22 PM

This thread is just to show an example of incorporating non-linear position sizing and stops based on historical volatility.

The example will take the historical volatility and input the value into the two 3rd order polynomials. Outputs will be stop in percent and position size multiplier.

What you will see is that for a more volatile stock the position size will be reduced and the stop will be increased. This will cause each trade to be more averaged and reduce portfolio volatility.

I have based the polynomial coefficients around a semi-automated mechanical system that I have traded for a year. This was previously done in Excel and I wanted to move it to SF so that a step was eliminated in the trading system.

Modify as required for your system.

Trade well.

Fetcher[and close 1 day ago more than 6% below close 2 day ago
and close more than 3% below close 1 day ago
and close above 5.99

set{HVol, Historical Volatility(6,1,250) / 100}

*
STOP
y=a+bx+cx2+dx3
a=3.5
b=10.25126263
c=-2.53787879
d=0.252525253
x=hvol
*/

set{stopx1, hvol}
set{stopx2, hvol * hvol}
set{stopx3, stopx2 * hvol}

set{stopd, stopx3 * 0.252525253}
set{stopc, stopx2 * -2.53787879}
set{stopb, stopx1 * 10.25126263}
set{stopa, 3.5}

set{stopcd, stopc + stopd}
set{stopcdb, stopcd + stopb}
set{stop, stopcdb + stopa}

/*POSITION
y=a+bx+cx2+dx3
a=1.207142857
b=-0.47560606
c=0.132943723
d=-0.01454545
x=hvol
*/

set{positionx1, hvol}
set{positionx2, hvol * hvol}
set{positionx3, positionx2 * hvol}

set{positiond, positionx3 * -0.01454545}
set{positionc, positionx2 * 0.132943723}
set{positionb, positionx1 * -0.47560606}
set{positiona, 1.207142857}

set{positioncd, positionc + positiond}
set{positioncdb, positioncd + positionb}
set{position, positioncdb + positiona}

add column hvol
add column stop
add column position
]



stocktrader
294 posts
msg #63471
Ignore stocktrader
6/7/2008 10:41:09 AM

Added stop and position to chart for visualization.

Fetcher[and close 1 day ago more than 6% below close 2 day ago
and close more than 3% below close 1 day ago
and close above 5.99

set{HVol, Historical Volatility(6,1,250) / 100}

/*
STOP
y=a+bx+cx2+dx3
a=3.5
b=10.25126263
c=-2.53787879
d=0.252525253
x=hvol
*/

set{stopx1, hvol}
set{stopx2, hvol * hvol}
set{stopx3, stopx2 * hvol}

set{stopd, stopx3 * 0.252525253}
set{stopc, stopx2 * -2.53787879}
set{stopb, stopx1 * 10.25126263}
set{stopa, 3.5}

set{stopcd, stopc + stopd}
set{stopcdb, stopcd + stopb}
set{stop, stopcdb + stopa}

/*POSITION
y=a+bx+cx2+dx3
a=1.207142857
b=-0.47560606
c=0.132943723
d=-0.01454545
x=hvol
*/

set{positionx1, hvol}
set{positionx2, hvol * hvol}
set{positionx3, positionx2 * hvol}

set{positiond, positionx3 * -0.01454545}
set{positionc, positionx2 * 0.132943723}
set{positionb, positionx1 * -0.47560606}
set{positiona, 1.207142857}

set{positioncd, positionc + positiond}
set{positioncdb, positioncd + positionb}
set{position, positioncdb + positiona}

draw stop
draw position

add column hvol
add column stop
add column position
]



TheRumpledOne
6,411 posts
msg #63513
Ignore TheRumpledOne
6/9/2008 3:57:46 PM

How's it going, Stocktrader?

stocktrader
294 posts
msg #63554
Ignore stocktrader
6/10/2008 5:55:05 PM

Going? Down lately :) ....and I am talking about stocks...lol

stocktrader
294 posts
msg #63739
Ignore stocktrader
6/15/2008 8:10:59 PM

See Active Trader Magazine, July 2008 issue, page 22.
"Adapting Position Size to Volatility"

The trading strategy in the magazine is very similar to what I'm doing in a portion of my semi-automatic mechanical system. When using stops, it reduces being stopped out unnecessarily. How many times have you been stopped out just to have the price reverse?

Also, if you have Excel it will generate the polynomial coefficients for your particular table boundaries and curvature.

Or, just follow the magazine formula.

Trade well.

TheRumpledOne
6,411 posts
msg #63745
Ignore TheRumpledOne
6/15/2008 10:50:19 PM

Thought you had it wired?

In a slump?



stocktrader
294 posts
msg #63747
Ignore stocktrader
6/15/2008 11:02:11 PM

There is a short circuit, called drawdown :)
Normal in trading, right?

stocktrader
294 posts
msg #63749
Ignore stocktrader
6/15/2008 11:12:27 PM

Drawdown

StockFetcher Forums · Filter Exchange · Position Sizing and Stop - Non-Linear 3rd Order Polynomial<< >>Post Follow-up

*** Disclaimer *** StockFetcher.com does not endorse or suggest any of the securities which are returned in any of the searches or filters. They are provided purely for informational and research purposes. StockFetcher.com does not recommend particular securities. StockFetcher.com, Vestyl Software, L.L.C. and involved content providers shall not be liable for any errors or delays in the content, or for any actions taken based on the content.


Copyright 2022 - Vestyl Software L.L.C.Terms of Service | License | Questions or comments? Contact Us
EOD Data sources: DDFPlus & CSI Data Quotes delayed during active market hours. Delay times are at least 15 mins for NASDAQ, 20 mins for NYSE and Amex. Delayed intraday data provided by DDFPlus


This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.