Discussions
»
Product and Service Development
»
Formula Assistance
»
Count the number of days Stoch > Stoch on a given bar
Rank: Member
Groups: Registered, Registered Users, Subscribers Joined: 9/25/2005(UTC) Posts: 23 Location: Melbourne, Australia
|
Hi, I want to count the number of times that Stoch(5,3) has been greater than Stoch(5,3) on any given bar, looking back 250 bars from that point.
I tried SUM(Stoch(5,3)>80,250) which worked fine, but I want to replace 80 with the current value of Stoch.
When I tried this, I just got zero as the result.
Cheers
Charmeta
|
|
|
|
Rank: Advanced Member
Groups: Registered, Registered Users, Subscribers, Unverified Users Joined: 10/28/2004(UTC) Posts: 3,111 Location: Perth, Western Australia
Was thanked: 16 time(s) in 16 post(s)
|
charmeta wrote:I want to count the number of times that Stoch(5,3) has been greater than Stoch(5,3) on any given bar, looking back 250 bars from that point.
Charmeta,
Do you want to specify the "given bar" or do you want the calculation performed for every bar?
If you want to compare the value of the Stoch() on every bar with the value of the Stoch() in the 250 preceeding bars, as far as I can figure, you cannot in the native MS Formula Language? By my reckoning, this is one of those (many) times when the loop function that cannot be done in MS is sorely needed. If you were only looking for say 20 or so periods there is a way to synthesise a loop, it isn't pretty but it works. The synthetic solution is out of the question for 250 bars. Loops can be easily done using external codes.
If you want to specify the bar on which to start the computation be a date or some other event, this can be achieved. If you want to compare the Stoch() in the last 250 bars on the chart, this too is achievable.
Provide a little more detail if you can, and we shall see what we can collectively achieve.
wabbit :D
|
|
|
|
Rank: Member
Groups: Registered, Registered Users, Subscribers Joined: 9/25/2005(UTC) Posts: 23 Location: Melbourne, Australia
|
Hi wabbit, thanks for your reply. I want to get a fix on what is overbought for a particular stock. I figure that if stoch reaches a peak that has only been reached say, 12 times in the last 12 months, it could be considered overbought.
This would give a more accurate signal than just using 80 or 90 as a trigger.
Also more volatile stocks tend to make higher peaks.
Basically, I'm looking for an adaptive stochastic.
Edited: Added "To do the calculation on every bar".
Cheers
charmeta
|
|
|
|
Rank: Advanced Member
Groups: Registered, Registered Users, Subscribers, Unverified Users Joined: 10/28/2004(UTC) Posts: 3,111 Location: Perth, Western Australia
Was thanked: 16 time(s) in 16 post(s)
|
If you want a variable Stoch indicator, this can be found in the free Forum.dll from the downloads section of the forum.
If you are looking for self-levelling indicators, then I can send you some stuff I developed some time a go, in the native MS formula language, or look here http://forum.equis.com/viewtopic.php?t=3157
If you want a custom external solution to count the bar, then you are going to have hire a code cutter to program it for you. I can do this for you, Jose can do it and there are others too.
wabbit :D
|
|
|
|
Rank: Member
Groups: Registered, Registered Users, Subscribers Joined: 9/25/2005(UTC) Posts: 23 Location: Melbourne, Australia
|
For the time being I can set it up to do the calc on the last 250 periods only, and do an exploration to filter out the ones of interest.
I'll take a look at the self levelling indicators link too, thanks wabbit.
|
|
|
|
Users browsing this topic |
Guest (Hidden)
|
Discussions
»
Product and Service Development
»
Formula Assistance
»
Count the number of days Stoch > Stoch on a given bar
Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.