StockFetcher Forums · General Discussion · Simple oscillator?<< >>Post Follow-up
Hookem
5 posts
msg #52574
Ignore Hookem
6/26/2007 10:27:39 PM

Hi,

New to the site and trying to figure out a couple of things.

As an exercise I wanted to create a query that simply found out stocks that oscillated on a daily basis (up down up down etc). I wanted to be able to query either based on the number of days or simply find the ones that have oscillated the longest. Although I've been pretty successful at creating queries using existing indicators, I haven't be able to get this to work yet. If there is an existing indicator that does this I haven't found it yet.

Could someone give me a little help with the code (or the existing indicator).

Thanks ahead of time.

nikoschopen
2,824 posts
msg #52575
Ignore nikoschopen
6/26/2007 11:15:08 PM

(1) If you mean by "up down up down" as the price change from open to close and vice versa, you could write it as:
Fetcher[
set{updown, sign(opcl) + sign(opcl 1 day ago)}
set{zigzag, count(updown equals 0, 1)}
set{zigzag5, count(zigzag equals 1,5)}
add column zigzag5
sort column 5 descending
]

This will find the occurence of an up day, namely the close is above the open, followed by a down day OR a down day followed by an up day within the last 5 days. The column labeled "zigzag5" will give you the number of such occurences within that time frame.

(2) If you mean by "up down up down" as the price change from the yesterday's close to todays's close, you could write it as:
Fetcher[
set{updown, sign(day change) + sign(day change 1 day ago)}
set{zigzag, count(updown equals 0, 1)}
set{zigzag5, count(zigzag equals 1,5)}
add column zigzag5
sort column 5 descending
]

This will find the occurence of an up day, namely it closed higher than yesterday's close, followed by a down day OR a down day followed by an up day within the last 5 days. The column labeled "zigzag5" will give you the number of such occurences within that time frame.


StockFetcher Forums · General Discussion · Simple oscillator?<< >>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.