Đang chuẩn bị nút TẢI XUỐNG, xin hãy chờ
Tải xuống
Tham khảo tài liệu 'ehlers, john - cybernetics analysis for stock and futures_4', tài chính - ngân hàng, đầu tư chứng khoán phục vụ nhu cầu học tập, nghiên cứu và làm việc hiệu quả | 70 CYBERNETIC ANALYSIS FOR STOCKS AND FUTURES setCursorLabelName StocRSI 0 setCursorLabelName Trig 1 setDefaultBarFgColor Color.blue 0 setDefaultBarFgColor Color.red 1 initialize arrays for x 0 x 70 X aRSIArrayfx 0.0 aValue3Array x 0.0 Main processing function function main RSILength StocLength WMALength var X var nDiff var nDivBy var nValuel var nValue2 initialize parameters if necessary if RSILength null RSILength 8 if StocLength null StocLength 8 if WMALength null WMALength 8 study is initializing if getBarState BARSTATE_ALLBARS return null initialize the basic RSI calculation if blnitialized false nAvgUpClose 0.0 nAvgDnClose 0.0 for x 0 x RSILength X FIGURE 8.2 Continued Stochasticization and Fisherization of Indicators 71 nDiff close -X - close - x 1 if nDiff 0 nAvgUpClose nDiff else nAvgDnClose Math.abs nDiff nAvgUpClose RSILength nAvgDnClose RSILength nRS nAvgUpClose nAvgDnClose nRSI 100.0 - 100.0 1.0 nRS blnitialized true continue the RSI calculation on subsequent bars else if getBarStateO BARSTATE-NEWBAR nAvgUpClose ntAvgUpClose nAvgDnClose ntAvgDnClose if tisNaNt nRSI aRSIArray.pop aRSIArray.unshift 0 aValue3Array.pop aValue3Array.unshift 0 nTrig nValue4 nDiff closet 0 - closet -1 if nDiff 0 ntAvgUpClose nAvgUpClose RSILength-1 nDiff I RSILength ntAvgDnClose nAvgDnClose RSILength-1 0 RSILength continued FIGURE 8.2 Continued 72 CYBERNETIC ANALYSIS FOR STOCKS AND FUTURES else ntAvgUpClose nAvgUpClose RSILength-1 0 RSILength ntAvgDnClose nAvgDnClose RSILength-1 Math.abs nDiff RSILength nRS ntAvgUpClose ntAvgDnClose nRSI 100.0 - 100.0 1 nRS aRSIArray 0 nRSI calculate the StocRSI using the RSI Array we. have created. nValuel nRSI - Lowest StocLength nValue2 Highest StocLength - Lowest StocLength nValue3 0 if nValue2 0 nValue3 nValuel I nValue2 aValue3Array 0 nValue3 compute weighted moving average nValue4 0 nDivBy 0 for x 0 x WMALength X nValue4 aValue3Array x WMALength-x nDivBy WMALength-x nValue4 nValue4 nDivBy nValue4 2.0 nValue4 - 0.5 return the calculated