### Replace Pioneer Home   All Examples   Free Download  RSS: Replace Pioneer Examples

# 582.Text data calculation -- How to calculate Williams %R from stock data?

 User: editor -- 2010-08-06          << 581  583 >> Hits: 2387 Type: Text data calculation Search all Text data calculation examples Description: How to calculate Williams %R from stock data? The formula for Williams %R (WMS) formula Let's start with 10 days. WMS = 100 * [(today's Close - Highest High in p1 periods) / (Highest High in p1 periods - Lowest Low in p1 periods)] Input Sample: CODE,DATE,OPEN,HIGH,LOW,CLOSE,VOLUME  AIQ,12/16/09,6.18,6.18,5.99,6.05,16330  AIQ,12/17/09,6.03,6.08,6.00,6.06,74300  AIQ,12/18/09,5.66,5.74,5.14,5.51,1677700  AIQ,12/21/09,5.51,5.60,5.45,5.47,388200  AIQ,12/22/09,5.48,5.72,5.48,5.72,336178 Output Sample: DATE TIME OPEN HIGH LOW VOLUME CLOSE WMS(10) 12/16/09 00:00 6.18 6.18 5.99 16330 6.05 -68.42  12/17/09 00:00 6.03 6.08 6.00 74300 6.06 -63.16  12/18/09 00:00 5.66 5.74 5.14 1677700 5.51 -64.42  12/21/09 00:00 5.51 5.60 5.45 388200 5.47 -68.27  12/22/09 00:00 5.48 5.72 5.48 336178 5.72 -44.23 Answer: Hint: You need to Download and install "Replace Pioneer" on windows platform to finish following steps. 1. ctrl-o open source text/csv file 2. ctrl-h open replace window * set 'replace scope' to 'Line' * set 'search for pattern' to: (.*?),(.*?),(.*?),(.*?),(.*?),(.*?),(\d+) * set 'replace with pattern' to: \2 00:00 \3 \4 \5 \7 \6 \$K * click 'advanced' page: set 'run following for each matched unit' to: #\$C=close \$H=high \$L=low \$A=0;\$B=0;\$D=0;\$F=0;\$S=0; \$C=words(\$match,6,6,','); \$H=words(\$match,4,4,','); \$L=words(\$match,5,5,','); #Save \$H \$L if (\$line_no==1) {for(0..9) { \$h[\$_]=\$H; \$l[\$_]=\$L; }} else { \$h[\$line_no%10]=\$H; \$l[\$line_no%10]=\$L;} #\$K=100*(\$C-Highest(\$L))/(Highest(\$H)-Lowest(\$L)) for(0..9) {if (\$H < \$h[\$_]) { \$H=\$h[\$_]; } if (\$L > \$l[\$_]) { \$L=\$l[\$_]; }} if (\$H==\$L) { \$K=-50; } else {\$K=100*(\$C-\$H)/(\$H-\$L);} \$K=calc(\$K,".2f"); 3. click 'Replace', done! Download Script:  scripts/582.rst.zip Screenshot 1:  Replace_Window Screenshot 2:  Replace_Advanced_Window Similar Examples: How to calculate Parabolic SAR on a 5 days basis of stock data? (67%)How to calculate OBV(On Balance Volume) base on stock data? (67%)How to calculate Acc/Dis, OBV and related MA values of stock data? (63%)How to caculate the last day of a month? (62%)How to calculate CFMO 15 and CFMO 21 from csv file of stock data? (62%)How to calculate SUM of EMAs and Covariance of close value from stock data? (61%)How to calculate Acc/Dis and corresponding 24 days' MA base on stock data? (56%)How to calculate Elder's Force Index (EFI) and related MA, EMA for stock data? (54%) Check Demo of Text data calculation Keywords: calculate williams r  how to calculate williams r  how to calculate williams  williams r  calculate williams  formula for williams r  highest high  periods  period  toc  search calculate replace  search replace calculate  if else  search data  10 10 100  replace with data  data replace  from start