Replace Pioneer Home   All Examples   Free Download

 New request --free  RSS: Replace Pioneer Examples

379.Text data calculation -- How to add MACD, EMA, FAST%K, SLOW%D columns for CSV file of stock data?

User: editor -- 2009-12-31          << 378  380 >>
Hits: 3564
Type: Text data calculation   
Search all Text data calculation examples
Description:
How to add MACD, EMA, FAST%K, SLOW%D columns for CSV file of stock data? 
 
MACD formula: 
DI = (High + Low + 2 * Close) / 4 
EMA(p1) = EMA of DI 
EMA(p2) = EMA of DI 
MACD = EMA(p2) - EMA(p1) 
Signal line = exponential moving average of MACD 
where MACD (12,26) 
and     MACD EMA (9) 
 
dRSV(p1) = 100 * [(today's Close - Lowest Low in p1 periods) /   
(Highest High in p1 periods - Lowest Low in p1 periods)]  
FAST_K(10,5) = EMA(5) of dRSV(10) 
SLOW_D(5)=EMA(5) of FAST_K(10,5)
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 MACD(12,26) EMA(9)_MACD FASK_K(10,5) SLOW_D(5) 
 
12/16/09 00:00 6.18 6.18 5.99 16330 6.05 -0.00 0.00 31.58 31.58 
12/17/09 00:00 6.03 6.08 6.00 74300 6.06 -0.00 0.00 33.33 32.16 
12/18/09 00:00 5.66 5.74 5.14 1677700 5.51 -0.05 -0.01 34.32 32.96 
12/21/09 00:00 5.51 5.60 5.45 388200 5.47 -0.09 -0.03 33.75 33.38 
12/22/09 00:00 5.48 5.72 5.48 336178 5.72 -0.11 -0.05 41.18 36.14
Answer:
Hint: You need to Download and install "Replace Pioneer" on windows platform to finish following steps.
1. ctrl-o open source text file 
2. ctrl-h open 'Replace' window 
set "Replace Unit" to "Chars" 
set "Replace Scope" to "Line" 
set "Search for Pattern" to: 
 
set "Replace with Pattern" to: 
 
click "Advanced" page,  
set "Run following for each matched unit" to the value in the 379.rst file. 
 
3. Click 'Replace' button, you will get 4 additional column with MACD(12,26), MACD EMA(9), FAST_K(10,5) and SLOW_D(5) 
4. ctrl-s save to file. 
 
Note:  
* you can also click "Batch..." button in step 3, if you need process multiple files. 
 
* formula: 
 
#$C=close $H=high $L=low 
#$E=($H+$L+2*$C)/4  
#$K=100*($C-Lowest($L))/(Highest($H)-Lowest($L)) 
#$M=EMA(12)-EMA(26) of $E 
#$D=EMA(9) of $M 
#$F=EMA(5) of $K 
#$S=EMA(5) of $F 
Download Script:  scripts/379.rst.zip

Screenshot 1:  Replace_Window


Screenshot 2:  Replace_Advanced_Window


Similar Examples:
How to add MACD, EMA, FAST%K, SLOW%D and BB columns for stock data? (88%)
How to generate EMA columns and related STD of close value from stock data? (55%)
How to add a column of Close Location Value("CLV") on stock data? (55%)
How to make subtraction on 2 columns of CSV file, and save it to TXT format? (52%)
How to calculate CFMO 15 and CFMO 21 from csv file of stock data? (48%)
How to calculate SUM of EMAs and Covariance of close value from stock data? (48%)
How to produce two new columns: MACD(12,26) and MACD EMA(9) on stock data? (48%)
How to merge two columns of a CSV file? (47%)

Check Demo of Text data calculation
Keywords:
macd  macd ema  highest high  addition  periods  sig  average  rage  period  toc  add columns  save each line of text files in  add line column  100 text files  text to columns open source  value column  calculation in text file  text columns