Hi,
In MT4 Stochastic implementation there are two options for “Price Field”:
Low/High
Close/Close
It looks like only first option (Low/High) is implemented in ProRealtime Stochastic. Can I ask for Close/Close option to be implemented as well? (or translated).
Following the article in https://www.forexfactory.com/showthread.php?t=36225
“As far as I can tell, High/Low uses the following formula to calc %K:
100 x (Recent Close – Lowest Low*) / (Highest High* – Lowest Low*)
[* for the last N periods, where N is the %K parameter]
whereas Close/Close uses the following formula to calc %K:
100 x (Recent Close – Lowest Close*) / (Highest Close* – Lowest Close*)”
Not sure if this is correct but I have not found alternative source with correct formula.
Thanks.
Here is the stochastic code with Close/Close:
r=5
q=3
p=14
REM Computes the highest and lowest prices on p bars
hi = highest[p](close)
lo = lowest[p](close)
REM Let's build the oscillator
oscillator = ((close - lo) / (hi - lo) * 100)
REM We can now compute the Stochastic lines
lineK = average[q](oscillator)
lineD = average[r](lineK)
RETURN lineK AS "%K", lineD AS "%D"
Many thanks Nicolas, that was really quick! will check it now.
🙂