StockFetcher Forums · Filter Exchange · Count problem with 2 indicators<< >>Post Follow-up
glgene
523 posts
msg #130104
Ignore glgene
7/27/2016 10:23:31 PM

This is my first experimental SF script using the "Count" feature. I can get my desired results with the MA50 count, but the script falls apart when I try to add an RSI14 (and total-- either 0, 1 or 2) count. Here is my script. Any suggestions?


Fetcher[
dow 30

add column ma(50)
add column rsi(14)

/*MA(50) check*/
set{ma50_check,count(close is above ma(50),1)}
set{ma52,ma50_check*1}
add column ma52{ma50_count}

/* RSI check */
set{RSI14_check,count(RSI(14) is above 49.99),1)}
set{RSI15,rsi14_check*1}
add column RSI15{rsi14_count}

set{Total,ma52+RSI15}
add column total
]



four
3,394 posts
msg #130106
Ignore four
modified
7/27/2016 11:28:12 PM

Retyped from scratch and simplified variable names.
Removed 'multiply by 1'

Fetcher[
add column separator
set{x, count(close > ma(50),1)}
add column x {ma50}

set{y, count(rsi(14) > 49.99,1)}
add column y {rsi14}

set{total, x + y}
add column total

add column ma(50)
add column rsi(14)
DOW 30
]



glgene
523 posts
msg #130147
Ignore glgene
7/28/2016 10:41:56 PM

Thank you, FOUR. Mission accomplished. I added a 3rd indicator (MACD-histogram) to the total mix, using your flow of SF script. I really wanted the MACD-PPO, but the script didn't like it. That's OK... because all I need is when either MACD number is positive or negative. It's the "crossover" that I am concerned with.

As you know, the MACD-Histogram and MACD-PPO [Percent Price Oscillator] have identical crossover points (Histogram is in $ and cents amt; PPO is in % amt).

It is my understanding that...
PPO = MACD histogram(12,26,9) divided by EMA(26).
I use the PPO number in a report I produce so I can compare different stocks on an apples-to-apples basis. Histogram doesn't allow a good comparison... but it works fine on an individual stock.

Without your assistance, I would not have figured out how to make Count work in my desired manner. THANK YOU.
-- Gene

four
3,394 posts
msg #130148
Ignore four
modified
7/29/2016 1:37:04 AM

You are very welcome.

I had to check your statement about them being the same and found they are not both MA nor both EMA.

From Indicator page in StockFetcher :

The Percent Price Oscillator (PPO)

is computed by taking the difference between two simple moving averages.

--

Moving Average Convergence Divergence (MACD)

Parameters
Period Fast EMA
Period Slow EMA2

Smoothing Period

And
http://www.stockfetcher.com/forums/General-Discussion/PPO-vs-MACD/96423


graftonian
220 posts
msg #130166
Ignore graftonian
modified
7/29/2016 1:30:29 PM

extra comma after "49.99" in original script.

StockFetcher Forums · Filter Exchange · Count problem with 2 indicators<< >>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 2016 - 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