StockFetcher Forums · Filter Exchange · Force Index --- how to round decimal info?<< 1 2 >>Post Follow-up
glgene
534 posts
msg #96365
Ignore glgene
9/18/2010 12:37:54 AM

Need some help with rounding. How do you round decimal info to nearest whole number?
Example, in the Force Index(13) numbers from the script below, I would like these results
(from 9/17/2010 run):

DTO Force Index(13) shows 59681.36. I would like it to show as 59681

NCV Force Index(13) shows 7239.69. I would like it to show as 7240

Fetcher[
stock is etf
Show stocks where force index(13) has been increasing over the last 3 days
and Volume is above 100000
and Average Volume(90) is above 50000
and close is between 5 and 250
set{v1,volume/average volume(50)}
set{v2,v1*100}
add column v2{vol-50d%}
set{w3,close/wma(30)}
set{w4,w3*100}
add column separator
add column w4{pr/wma30%}
add column w4 1 day ago{pr/wma-1d}
add column separator
add column rsi(10)
add column rsi(10) 1 day ago{rsi-1d}
add column separator
add column ppo(12,26)
add column ppo(12,26) 1 day ago{PPO-1d}
add column separator
add column fi(13)
add column fi(13) 1 day ago{fi13-1d}
add column fi(13) 2 days ago{fi-2d}
add column fi(13) 3 days ago{fi-3d}
draw ppo(12,26)
sort column 3 descending
]



--Zack

four
3,998 posts
msg #96366
Ignore four
modified
9/18/2010 1:36:56 AM

Fetcher[
add column round(fi(13))
add column fi(13)
]



glgene
534 posts
msg #96368
Ignore glgene
9/18/2010 2:32:53 AM

OK, I added your script info. Thanks. Except, I still get 2-decimal output:

I originally displayed, with my script, 59681.36 for DTO. I wanted 59681.

Your script got me 59681.00

I simply want to suppress the decimal-related info (to save space).

Can that be done?

Zack

four
3,998 posts
msg #96374
Ignore four
9/18/2010 12:23:02 PM

I do not think so....

glgene
534 posts
msg #96377
Ignore glgene
9/18/2010 10:08:49 PM

four,
I have followed the inverse of your Aug. 20 advice when I asked a somewhat similar question on my "Death Cross" post. You said to 'multiply' by 100 to get my desired result. I did, and it worked quite well.

Now, with my thread on the "Force Index" question, I am going to 'divide' by 100 to help seek the solution to my concern.

For example, with DTO as the first ETF shown on my 9/17/2010 search, it produced a Force Index(13) number of 59681.36. By dividing by 100, it comes out to 596.81. Saves me 2 digits per column, and since I'm displaying the Force Index number for the current day + 3 previous days, that saves me 8 characters in width. I need that space to make room for other columns I show.

I use the Force Index(13) in a relative manner (how it compares with other ETFs/stocks. So by dividing by 100, the end results are relative to each other, in the same proportion. For the column heading, I simply add reference that the column is divided by 100.

four...thanks for your ongoing help. You're always there with a helping hand to help newbies like me.

By the way, I ran the Force Index script and, alternatively, I deleted reference to ETFs only. Works extremely well with stocks, too.

Zack

four
3,998 posts
msg #96378
Ignore four
9/18/2010 11:05:10 PM

bingo

glgene
534 posts
msg #96379
Ignore glgene
9/19/2010 9:56:50 AM

four,
Your response would be appreciated to my following, add-on question to the indicator Force Index:

Force Index, by definition, is as follows:

"It is the difference between today's close and yesterday's close times today's volume."

So, using my original ETF-related script on Force Index, here is the top-ranked ETF end-of-day on 9/17/2010 (using % change, descending, as the sort order): DTO.

DTO price close on 9/17/2010: $80.02
DTO price close on 9/16/2010: $78.17

The difference is $1.85.

DTO volume, per SF, on 9/17/2010 was 332,800 shares.

Thus, $1.85 x 332,800 = 615,680 Force Index(1) on 9/17/2010. That basically agrees with Stockcharts.com (except SF says there were 332,800 shares traded on 9/17/2010. Stockcharts.com says there were 332,710 shares traded). Close enough.

But what isn't close enough is the calculation of Force Index(13):

Stockfetcher.com says FI(13) on 9/17/2010 is 59,681. Stockcharts says it's 155,424. That's a big difference!

The question: What is the correct Force Index(13) number on 9/17/2010? I think both smooth using the 13-day EMA, but maybe I'm wrong. Does SF use EMA in the calculation of a smoothed Force Index number?

???

Zack

four
3,998 posts
msg #96380
Ignore four
9/19/2010 12:31:42 PM

I guess you could throw to Stockfetcher...

See what they say about the data discrepancy.
Let me/us know.
---------------------------------------------------------
support@stockfetcher.com

glgene
534 posts
msg #96388
Ignore glgene
9/19/2010 3:22:47 PM

four,
I have taken your advice and written to Stockfetcher Support. Here is the e-mail I just sent:
-------------------------------
Support@Stockfetcher.com

I have been a subsciber to Stockfetcher.com for some time, and yesterday I came across a potential scripting/computation problem. It involves the indicator 'Force Index.'

Computation of the 1-day Force Index seems to be in synch (as the run from the script below shows), but computation of the Force Index(13) doesn't match with another charting service (Stockcharts.com). I'm not sure which one is correct, or maybe they both are (EMA vs. SMA).

Here are comparative Force Index(13) results, run with end-of-day data on 9-17-2010:

................................................SPY ..........................DIA.........................DTO

Stockfetcher.com .......... 116621152.00 ......... 3034700.50 .............. 59681.36

Stockcharts.com ............. 59562368.00 ......... 1550264.00 ............. 155424.80

Does Stockfetcher use the exponential moving average (EMA) on computation of Force Index (13), or simple moving average (SMA)?
I'll ask Stockcharts.com that same question.

Shown below is the SF script I developed with regard to this project:

Fetcher[
symlist(spy,dia,dto)
chart-time is 6 months
add column close 1 day ago{Prev. day}
set{d,close-close 1 day ago}
add column d{1-day change}
set{e,d*volume}
add column e{Vol.* 1day change}
add column Force Index(1)
add column Force Index(13)
draw Force Index(13)
]



------------------------------------
Please advise. Thanks so much. I love your product, Stockfetcher!


glgene
534 posts
msg #96394
Ignore glgene
9/19/2010 9:36:17 PM

Got the word from Stockfetcher Support. Yes, the SF default calculation of Force Index(13) is the simple moving average (not EMA). That's why their calculations didn't match Stockcharts.

To get an EMA of the Force Index(13) number, I need to add this line, per SF:

Draw CEMA(FI(1),13)
Add column CEMA(FI(1),13)

I did that, and now my DTO (stock) Force Index(13) numbers for 9-17-2010 are almost a perfect match.

The SPY and DIA numbers still differ greatly. ???

SF typically uses a 2-year lookback on EMA calculations. If Stockcharts uses a different lookback period, that explains why SC and SF numbers don't match.

I am inclined to go with the CEMA calculations for my SF script.


StockFetcher Forums · Filter Exchange · Force Index --- how to round decimal info?<< 1 2 >>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