顯示包含「GOOGLEFINANCE」標籤的文章。顯示所有文章
顯示包含「GOOGLEFINANCE」標籤的文章。顯示所有文章

2021年6月10日星期四

Real-time KD trajectory analysis of the Hang Seng Index

 



Chart description:



  1. Vertical axis: K value
  2. Horizontal axis: D value
  3. 45-degree bisector: K=D
  4. Above the 45-degree bisector: K>D, which can be understood as uptrend
  5. Below the 45-degree bisector: K<D, which can be understood as downtrend
  6. Green words: rising 
  7. Red words: declining 
  8. K<25, D<25, below the 45-degree equidistant line, the green word: KD golden cross stocks will soon appear, which can be understood as a buy signal
  9. K>75, D>75, above the 45-degree bisector, red words: stocks with KD dead cross will appear soon, which can be understood as a sell signal

KDJ cycle trajectory analysis, technical analysis from a new perspective

 
The picture below shows a complete KD cycle:



  1. Vertical axis: K value
  2. Horizontal axis: D value
  3. 45-degree bisector: K=D
  4. Above the 45-degree bisector: K>D, which can be understood as uptrend
  5. Below the 45-degree bisector: K<D, which can be understood as downtrend
  6. Green words: rising 
  7. Red words: declining 
  8. K<25, D<25, below the 45-degree equidistant line, the green word: KD golden cross stocks will soon appear, which can be understood as a buy signal
  9. K>75, D>75, above the 45-degree bisector, red words: stocks with KD dead cross will appear soon, which can be understood as a sell signal

The following is the real cycle of the Hang Seng Index:




美股三大指數實時KD軌跡分析


納斯達克綜合指數:



S&P 500:



道瓊工業平均指數:



圖表說明:


 

  1. 縱軸: K值
  2. 橫軸: D值
  3. 45度等分線: K=D
  4. 45度等分線上方: K>D, 可理解為有上升潛力 
  5. 45度等分線下方: K<D, 可理解為有下行壓力
  6. 綠色字: 上升中的股票
  7. 紅色字: 下跌中的股票
  8. K<25,D<25, 45度等分線下方,綠色字: 快將出現KD金叉的股票  可理解為買入訊號
  9. K>75,D>75, 45度等分線上方,紅色字: 快將出現KD死叉的股票  可理解為賣出訊號 

2021年6月9日星期三

[KDJ Analysis 2]: KDJ Global Real-time Monitoring Sharing(Hang Seng Composite LargeCap as an example)

 

 



Chart explanation:

  1. Vertical axis: K value
  2. Horizontal axis: D value
  3. 45-degree bisector: K=D
  4. Above the 45-degree bisector: K>D, which can be understood as having upward potential
  5. Below the 45-degree bisector: K<D, which can be understood as having downward pressure
  6. Green words: stocks which is rising
  7. Red words: stocks which is declining
  8. K<25, D<25, below the 45-degree equidistant line, the green word: KD golden cross stocks will soon appear, which can be understood as a buy signal
  9. K>75, D>75, above the 45-degree bisector, red words: stocks with KD dead cross will appear soon, which can be understood as a sell signal







[KDJ分析二] : KDJ 全局即時監察分享 (恒生大型綜合指數)

 



圖表解說:

  1. 縱軸: K值
  2. 橫軸: D值
  3. 45度等分線: K=D
  4. 45度等分線上方: K>D, 可理解為有上升潛力 
  5. 45度等分線下方: K<D, 可理解為有下行壓力
  6. 綠色字: 上升中的股票
  7. 紅色字: 下跌中的股票
  8. K<25,D<25, 45度等分線下方,綠色字: 快將出現KD金叉的股票  可理解為買入訊號
  9. K>75,D>75, 45度等分線上方,紅色字: 快將出現KD死叉的股票  可理解為賣出訊號






[KDJ Analysis 1]: Google Sheets - 2 equations to calculate the KD value in any time range

This tutorial is mainly to design how to use the shortest equation to calculate the KD value in any time range and the principle behind it.


The K value formula is:

[Close(today) - Min (low 9 day)] / [Max (high 9 day) - Min (low 9 day)] *100/ 3 + K(Yesterday) 2/3


The equation in F2 is:  (E2-min(D2:D10))/(max(C2:C10)-min(D2:D10))*100/3+F3*2/3

Note: This equation needs to be pulled down manually. If you want to achieve automatic calculation, please continue to see the following teaching.

Since Max and Min cannot be used in Arrayformula, a more powerful function Query is required in this case.

Step 1: K value calculation




1. Enter the equation in H1: Query(C2:C,"Select *")

2.Enter this equation in I1: Query(C2:C,"Select * offset 1"), Enter this equation in I1:: Query(C2:C,"Select * offset 2"),Repeat 8 times.

3. In this way, there are 9 days of data for a single row:


4. But in this way, the length of each column is different, so'Limit' must be added, and the H1 equation is:

H1 = QUERY(C2:C,"Select * limit "&Count(C2:C)-8&" offset 0")

5. The 9-day array is:

 H1 = {QUERY(C2:C,"Select * limit "&Count(C2:C)-8&" offset 0"),QUERY(C2:C,"Select * limit "&Count(C2:C)-8&" offset 1"),QUERY(C2:C,"Select * limit "&Count(C2:C)-8&" offset 2"),QUERY(C2:C,"Select * limit "&Count(C2:C)-8&" offset 3"),QUERY(C2:C,"Select * limit "&Count(C2:C)-8&" offset 4"),QUERY(C2:C,"Select * limit "&Count(C2:C)-8&" offset 5"),QUERY(C2:C,"Select * limit "&Count(C2:C)-8&" offset 6"),QUERY(C2:C,"Select * limit "&Count(C2:C)-8&" offset 7"),QUERY(C2:C,"Select * limit "&Count(C2:C)-8&" offset 8")}

6. At this time, just use transpose to get the following array:

 


7. Just use Query Max(Col1), Max(Col2), Max(Col3)... to find the corresponding Max (high 9 day) every day, the question is how many Col...


8.  To find out how many Col, you have to find out how many columns of data High has, and enter the equation in H10:

H10=ArrayFormula(if(len(C10:C),ROW(C10:C)-Row(C10)+1,""))


9. Then combined into the query syntax of Query, the H10 equation is changed to:

H10=ArrayFormula(if(len(C10:C),"Max(Col"&ROW(C10:C)-Row(C10)+1&"),",""))

10. Then use Join to change it to a string, and the H10 equation change to:

 H10=Join(,ArrayFormula(if(len(C10:C),"Max(Col"&ROW(C10:C)-Row(C10)+1&"),","")))

11. Then use Join to change it to a string, and the H10 equation to change it to:

H10=REGEXREPLACE(join("",ArrayFormula(if(len(C10:C),"Max(Col"&ROW(C10:C)-ROW(C10)+1&"),",""))), ".\z","")


among them: REGEXREPLACE(join("",ArrayFormula(if(len(C10:C),"Max(Col"&ROW(C10:C)-ROW(C10)+1&"),",""))), ".\z","") is query string

 

12.Combine the two and enter the equation in G2 to get the Max (high 9 day) corresponding to each day:

G2=query(transpose(query(transpose(Query({ARRAY_CONSTRAIN(QUERY(C2:C,"Select *"),Count(C2:C)-8,1),ARRAY_CONSTRAIN( QUERY(C2:C,"Select * offset 1"),Count(C2:C)-8,1),ARRAY_CONSTRAIN( QUERY(C2:C,"Select * offset 2"),Count(C2:C)-8,1),ARRAY_CONSTRAIN( QUERY(C2:C,"Select * offset 3"),Count(C2:C)-8,1),ARRAY_CONSTRAIN( QUERY(C2:C,"Select * offset 4"),Count(C2:C)-8,1),ARRAY_CONSTRAIN( QUERY(C2:C,"Select * offset 5"),Count(C2:C)-8,1),ARRAY_CONSTRAIN( QUERY(C2:C,"Select * offset 6"),Count(C2:C)-8,1),ARRAY_CONSTRAIN( QUERY(C2:C,"Select * offset 7"),Count(C2:C)-8,1),ARRAY_CONSTRAIN( QUERY(C2:C,"Select * offset 8"),Count(C2:C)-8,1)},"Select* ")),"Select "&REGEXREPLACE(join("",ArrayFormula(if(len(C10:C),"Max(Col"&ROW(C10:C)-ROW(C10)+1&"),",""))), ".\z","")&"")),"Select Col2")


13. Min (low 9 day) is also found in the same way, and the final K value formula is:

 G2=ArrayFormula(iferror((100*(E2:E-query(transpose(query(transpose(Query({ARRAY_CONSTRAIN(QUERY(D2:D,"Select *"),Count(D2:D)-8,1),ARRAY_CONSTRAIN( QUERY(D2:D,"Select * offset 1"),Count(D2:D)-8,1),ARRAY_CONSTRAIN( QUERY(D2:D,"Select * offset 2"),Count(D2:D)-8,1),ARRAY_CONSTRAIN( QUERY(D2:D,"Select * offset 3"),Count(D2:D)-8,1),ARRAY_CONSTRAIN( QUERY(D2:D,"Select * offset 4"),Count(D2:D)-8,1),ARRAY_CONSTRAIN( QUERY(D2:D,"Select * offset 5"),Count(D2:D)-8,1),ARRAY_CONSTRAIN( QUERY(D2:D,"Select * offset 6"),Count(D2:D)-8,1),ARRAY_CONSTRAIN( QUERY(D2:D,"Select * offset 7"),Count(D2:D)-8,1),ARRAY_CONSTRAIN( QUERY(D2:D,"Select * offset 8"),Count(D2:D)-8,1)},"Select* ")),"Select "&REGEXREPLACE(join("",ArrayFormula(if(len(C10:C),"Min(Col"&ROW(C10:C)-ROW(C10)+1&"),",""))), ".\z","")&"")),"Select Col2"))/(query(transpose(query(transpose(Query({ARRAY_CONSTRAIN(QUERY(C2:C,"Select *"),Count(C2:C)-8,1),ARRAY_CONSTRAIN( QUERY(C2:C,"Select * offset 1"),Count(C2:C)-8,1),ARRAY_CONSTRAIN( QUERY(C2:C,"Select * offset 2"),Count(C2:C)-8,1),ARRAY_CONSTRAIN( QUERY(C2:C,"Select * offset 3"),Count(C2:C)-8,1),ARRAY_CONSTRAIN( QUERY(C2:C,"Select * offset 4"),Count(C2:C)-8,1),ARRAY_CONSTRAIN( QUERY(C2:C,"Select * offset 5"),Count(C2:C)-8,1),ARRAY_CONSTRAIN( QUERY(C2:C,"Select * offset 6"),Count(C2:C)-8,1),ARRAY_CONSTRAIN( QUERY(C2:C,"Select * offset 7"),Count(C2:C)-8,1),ARRAY_CONSTRAIN( QUERY(C2:C,"Select * offset 8"),Count(C2:C)-8,1)},"Select* ")),"Select "&REGEXREPLACE(join("",ArrayFormula(if(len(C10:C),"Max(Col"&ROW(C10:C)-ROW(C10)+1&"),",""))), ".\z","")&"")),"Select Col2")-query(transpose(query(transpose(Query({ARRAY_CONSTRAIN(QUERY(D2:D,"Select *"),Count(D2:D)-8,1),ARRAY_CONSTRAIN( QUERY(D2:D,"Select * offset 1"),Count(D2:D)-8,1),ARRAY_CONSTRAIN( QUERY(D2:D,"Select * offset 2"),Count(D2:D)-8,1),ARRAY_CONSTRAIN( QUERY(D2:D,"Select * offset 3"),Count(D2:D)-8,1),ARRAY_CONSTRAIN( QUERY(D2:D,"Select * offset 4"),Count(D2:D)-8,1),ARRAY_CONSTRAIN( QUERY(D2:D,"Select * offset 5"),Count(D2:D)-8,1),ARRAY_CONSTRAIN( QUERY(D2:D,"Select * offset 6"),Count(D2:D)-8,1),ARRAY_CONSTRAIN( QUERY(D2:D,"Select * offset 7"),Count(D2:D)-8,1),ARRAY_CONSTRAIN( QUERY(D2:D,"Select * offset 8"),Count(D2:D)-8,1)},"Select* ")),"Select "&REGEXREPLACE(join("",ArrayFormula(if(len(C10:C),"Min(Col"&ROW(C10:C)-ROW(C10)+1&"),",""))), ".\z","")&"")),"Select Col2"))/3+F3:F*2/3),""))

 


The results of the two algorithms are consistent

Step 2: D value calculation

1.  The D value calculation is much simpler, enter the equation in H2:

H2=ArrayFormula(if(G2:G="","",G2:G/3+H3:H*2/3)) 


The following is a demonstration to compare the differences between the two K value calculations:

https://docs.google.com/spreadsheets/d/1WaK6lOPyO83eKQoJ8lL6NdWdegaAAXhZ9t_Uez6tZtc/edit#gid=674994167