Stochastic indicator

How to create strategies and indicators
Message
Author
philBell
Posts: 24
Joined: Thu Jul 23, 2009 7:20 am
Location: Brighton, UK

Stochastic indicator

#1 Postby philBell » Sun Aug 16, 2009 2:35 pm

I've been trying to write a strategy that uses a stochastic oscillator. I had been creating it using

stoc := CreateIndicator( Symbol, TimeFrame, 'Stochastic', '14;3;3;Close' );

because the stochastic expresses a candle's Close as a percentage of the highest high to lowest low range. Earlier today it was working enough to try running the Strategy Optimiser with it. Then I made some changes and have presumably introduced a programming error that's making Fast Test lock up ForexTester, requiring the use of Task Manager to terminate it. Maybe I'll see the problem when I wake up tomorrow.

However, while trying to find the problem, I noticed that Stochastic windows were being added to the price chart with a caption

(8, 3, 3, illegal value)

and looking at the parameters in the Indicators List's Edit, it seems that the allowable values for the final parameter are

High/Low
Close/Close

although StrPriceType(pt_Close) returns 'Close' and it has no 'High/Low' result matching the example in the List of Indicator Parameters in the Strategy API Help text for the Stochastic.

What's the significance of this final parameter? I've never seen any reference to variations in the stochastic formula in books, as far as I can remember; its shown as

(today's Close - lowest low in %K periods) / (highest high in %K periods - lowest low in %K periods)

in Achelis' book (hence my attempt to make the third parameter select Close).

Phil Bell
Attachments
Image2.png
Image2.png (9.85 KiB) Viewed 7440 times
Image1.png
Image1.png (9.64 KiB) Viewed 7440 times

User avatar
Terranin
Site Admin
Posts: 833
Joined: Sat Oct 21, 2006 4:39 pm

Re: Stochastic indicator

#2 Postby Terranin » Thu Aug 20, 2009 11:11 am

philBell wrote:I've been trying to write a strategy that uses a stochastic oscillator. I had been creating it using

stoc := CreateIndicator( Symbol, TimeFrame, 'Stochastic', '14;3;3;Close' );

because the stochastic expresses a candle's Close as a percentage of the highest high to lowest low range. Earlier today it was working enough to try running the Strategy Optimiser with it. Then I made some changes and have presumably introduced a programming error that's making Fast Test lock up ForexTester, requiring the use of Task Manager to terminate it. Maybe I'll see the problem when I wake up tomorrow.

However, while trying to find the problem, I noticed that Stochastic windows were being added to the price chart with a caption

(8, 3, 3, illegal value)

and looking at the parameters in the Indicators List's Edit, it seems that the allowable values for the final parameter are

High/Low
Close/Close

although StrPriceType(pt_Close) returns 'Close' and it has no 'High/Low' result matching the example in the List of Indicator Parameters in the Strategy API Help text for the Stochastic.

What's the significance of this final parameter? I've never seen any reference to variations in the stochastic formula in books, as far as I can remember; its shown as

(today's Close - lowest low in %K periods) / (highest high in %K periods - lowest low in %K periods)

in Achelis' book (hence my attempt to make the third parameter select Close).

Phil Bell


Use "Close/Close" instead of just "Close". It should be the same string as you see in Indicator's options. We took this syntax from Meta Trader stochastic.
Hasta la vista
Mike


Return to “FT API”

Who is online

Users browsing this forum: No registered users and 16 guests