I wasn't sure if the built in stoch lets you modify the lookback period so I made one that calculates every part of the stochastic straight from the original equation.
The only relevant information is in the examplee function
How to change window length
Enter desired time length in the excel document under the highlighted cells
All you need to do is change the window length on the H and L data.history (to the numbers under the Safe lookback length cell)
Window length that is to be changed is found here
H = data.history(positionz, 'high', 3785, '1m')
L = data.history(positionz, 'low', 3785, '1m')
enter the values under the start:end:step rows in the slice functions under hii, hii2, hii3, hii4, and hii5
do the same to the loo, loo1, loo2, loo3, loo4, and loo5 slice functions
Found here..
hii = H[-2941 : -1 : 210]
hii2 = H[-3150 : -210 : 210]
hii3 = H[-3360 : -420 : 210]
hii4 = H[-3570 : -630 : 210]
hii5 = H[-3780 : -840 : 210]
and
loo = L[-2941 : -1 : 210]
loo2 = L[-3150 : -210 : 210]
loo3 = L[-3360 : -420 : 210]
loo4 = L[-3570 : -630 : 210]
loo5 = L[-3780 : -840 : 210]
Here is the excel document calculating the requested time values
^That is to be used in the slice functions between 'hii-hii5' and 'loo-loo5'^
The H and L window length is calculated in the excel document as well... It can be found under "Safe lookback length"