<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	
	xmlns:georss="http://www.georss.org/georss"
	xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#"
	>

<channel>
	<title>Talib &#8211; FinLab</title>
	<atom:link href="https://www.finlab.tw/tag/talib/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.finlab.tw</link>
	<description>深入淺出的量化投資，讓你在在茫茫股海中，找到專屬於自己的投資方法</description>
	<lastBuildDate>Thu, 22 Dec 2022 08:08:28 +0000</lastBuildDate>
	<language>zh-TW</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.0.9</generator>

<image>
	<url>https://www.finlab.tw/wp-content/uploads/2020/07/favicon.png</url>
	<title>Talib &#8211; FinLab</title>
	<link>https://www.finlab.tw</link>
	<width>32</width>
	<height>32</height>
</image> 
<site xmlns="com-wordpress:feed-additions:1">179699571</site>	<item>
		<title>技術指標教室｜動量指標 AROON</title>
		<link>https://www.finlab.tw/aroon_indicator/</link>
					<comments>https://www.finlab.tw/aroon_indicator/#respond</comments>
		
		<dc:creator><![CDATA[Ben]]></dc:creator>
		<pubDate>Thu, 22 Dec 2022 08:05:38 +0000</pubDate>
				<category><![CDATA[技術面]]></category>
		<category><![CDATA[FinLab 量化平台]]></category>
		<category><![CDATA[Python新手教學]]></category>
		<category><![CDATA[投資新手]]></category>
		<category><![CDATA[AROON]]></category>
		<category><![CDATA[Talib]]></category>
		<category><![CDATA[動量指標]]></category>
		<category><![CDATA[氣數指標]]></category>
		<guid isPermaLink="false">https://www.finlab.tw/?p=4979</guid>

					<description><![CDATA[TA-Lib（Technical Analysis Library）是一個開源的技術分析模組，可以免費使用，用 [&#8230;]]]></description>
										<content:encoded><![CDATA[
<p class="has-medium-font-size"><a href="https://mrjbq7.github.io/ta-lib/" target="_blank" rel="noopener">TA-Lib</a>（Technical Analysis Library）是一個開源的技術分析模組，可以免費使用，用於計算股票技術指標。包含了超過 200 種技術指標的實現，包括常見的指標如移動平均線（Moving Average）、布林通道 (Bollinger Bands)、RSI 和 MACD 等，以及較少使用的指標如 KST、Vortex Indicator 和 Chande Momentum Oscillator等。<br>這麼好用的模組，你使用到多少呢？除了耳熟能詳的KD、RSI和MACD？還有許多你沒聽過的技術指標～越少人用的指標是否越有效？值得挖寶，技術指標教室將逐一探索較少見的指標，例如這次要介紹的動量指標「AROON」。</p>



<h2>Momentum indicators（動量指標）是什麼？</h2>



<p class="has-medium-font-size">動量指標的核心含義是：「如果股票的價格正在上漲，那麼它就具有正的動量，反之亦然。因此，動量指標通常用於確定股票的趨勢，並預測價格的未来變化。</p>



<p class="has-medium-font-size">常見的動量指標包括相對强弱指標（Relative Strength Index，RSI）和快速隨機指標（Fast Stochastic Oscillator）等。這些指標通常使用股票的收盤架或成交量来计算，並與股票的過去一段時間的價格或成交量進行比較。</p>



<h2>Aroon 技術指標是什麼？</h2>



<p class="has-medium-font-size">AROON 是一種股票技術指標，用於評估股票或其他市場資產的趨勢強度和持續時間。 Aroon指標包括兩條曲線：Aroon Up和Aroon Down。 Aroon Up指標衡量股票在過去多少天內出現過新高，而Aroon Down指標則衡量股票在過去多少天內出現過新低。</p>



<h3>AROON 技術指標公式</h3>



<p class="has-medium-font-size">AROON 指標可以用於識別股票的趨勢轉折點，並評估趨勢的強度和持續時間。它也可以與其他技術指標一起使用，以更精確地分析市場趨勢。</p>



<p class="has-medium-font-size">Aroon Up指標的公式如下：</p>



<p class="has-medium-font-size">Aroon Up = (Number of periods &#8211; Days since the highest high) / Number of periods x 100</p>



<p class="has-medium-font-size">Aroon Down指標的公式如下：</p>



<p class="has-medium-font-size">Aroon Down = (Number of periods &#8211; Days since the lowest low) / Number of periods x 100</p>



<p class="has-medium-font-size">在這些公式中，「Number of periods」是指要使用的時間段數量，通常為25天或50天。「Days since the highest high」是指自上一個新高以來的天數，而「Days since the lowest low」則是指自上一個新低以來的天數。</p>



<p class="has-medium-font-size">為了計算Aroon Up和Aroon Down指標，需要對股票的每一天的最高價和最低價進行追蹤，並計算自上一個新高或新低以來的天數。然後，可以使用公式計算 Aroon Up 和 Aroon Down 指標的值。</p>



<p class="has-medium-font-size">比方計算25天內的 AROON，若最高價出現在第3天，則 Aroon Up 為 12 (3/25*100)，若最高價出現在最近一日，則 Aroon Up 為 100。若最低價出現在第10天，則 Aroon DOWN 為 40 (10/25*100)。</p>



<p class="has-medium-font-size">Ta-lib 的 AROON 函數如下：</p>



<pre class="wp-block-preformatted">aroondown, aroonup = AROON(high, low, timeperiod=14)</pre>



<h3>AROON技術指標分析應用</h3>



<p class="has-medium-font-size">Aroon Up 和 Aroon Down 指標的值介於0到100之間，Aroon Up 越大代表股價在越近期創新高。Aroon Down 越大代表股價在越近期創新低。<br>AroonOsc 為延伸應用，定義為 Aroon Up 與 Aroon Down 相減。</p>



<p class="has-medium-font-size">當 AroonOsc 為正數時，代表創高日離近期較近，創低日較近期較遠，通常意味著股票正在處於創高的強勢過程，而當 AroonOsc 為負數 時，則意味著股票正在下跌創低的過程。</p>



<p class="has-medium-font-size">當 Aroon Up 指標向下跌破 50 時，表示向上的趨勢正在失去動力；當 Aroon Down 指标向下跌破50時，表示向下的趨勢正在失去動力；如果兩個指標都在低位，表示股價没有明確的趨勢；如果指標在70 以上，表示趨勢十分强烈；如果在30 以下，表明相反的趨勢正在醞釀。通常來說，AroonOsc 在0附近時，是典型的無趨勢特徵，股票處於盤整階段 (<a href="https://wizardforcel.gitbooks.io/python-quant-uqer/content/78.html" target="_blank" rel="noopener">參考來源</a>)。</p>



<h2>FinLab 量化平台實驗 AROON 指標選股</h2>



<p class="has-medium-font-size">第一次接觸該指標，不知道怎麼做才最好？<br>可以使用 FinLab 模組的<a href="https://doc.finlab.tw/reference/optimize/" target="_blank" rel="noopener">選股條件組合優化器</a>，將可能的條件都先寫出來，最後讓組合優化器將個條件組合全跑一遍，看哪一種效果最好。這次實驗的條件都以AROON指標相關，實驗市場通常使用的條件。</p>



<h3>實驗條件</h3>



<h4>持有條件</h4>



<ul class="has-medium-font-size"><li>AROON 指標週期設定25日</li><li>aroonup &gt; aroondown : 創高日比創低日較近期發生</li><li>aroonup &gt; 70</li><li>aroondown &lt; 30</li><li>每月換股</li></ul>



<h4>出場條件</h4>



<ul class="has-medium-font-size"><li>aroonup &lt; aroondown : 創低日比創高日較近期發生</li></ul>



<h3>程式範例</h3>



<pre class="wp-block-code"><code lang="python" class="language-python">from finlab.backtest import sim
from finlab import data
from finlab.optimize.combinations import sim_conditions

with data.universe(market='TSE_OTC'):
    close = data.get("price:收盤價")
    aroondown, aroonup = data.indicator("AROON", adjust_price=True, timeperiod=25)
    c1 = aroonup &gt; aroondown
    c2 = aroonup &gt; 70
    c3 = aroondown &lt; 30
    exits = aroonup &lt; aroondown

    conditions = {'c1':c1, 'c2':c2, 'c3':c3}
    report_collection = sim_conditions(conditions=conditions, resample='M', hold_until={'exit':exits, 'stop_loss':0.1}, position_limit=0.1, upload=False)

# 策略分組指標報告
report_collection.plot_creturns().show()
report_collection.plot_stats('bar').show()
report_collection.plot_stats('heatmap')
</code></pre>



<h3>回測結果</h3>



<figure class="wp-block-image size-large"><img width="1024" height="291" src="https://www.finlab.tw/wp-content/uploads/2022/12/newplot-43-1024x291.png" alt="newplot 43" class="wp-image-4990" srcset="https://www.finlab.tw/wp-content/uploads/2022/12/newplot-43-1024x291.png 1024w, https://www.finlab.tw/wp-content/uploads/2022/12/newplot-43-300x85.png 300w, https://www.finlab.tw/wp-content/uploads/2022/12/newplot-43-768x218.png 768w, https://www.finlab.tw/wp-content/uploads/2022/12/newplot-43-1536x437.png 1536w, https://www.finlab.tw/wp-content/uploads/2022/12/newplot-43.png 1847w" sizes="(max-width: 1024px) 100vw, 1024px" title="技術指標教室｜動量指標 AROON 1"></figure>



<figure class="wp-block-image size-large"><img loading="lazy" width="1024" height="291" src="https://www.finlab.tw/wp-content/uploads/2022/12/newplot-45-1024x291.png" alt="newplot 45" class="wp-image-4991" srcset="https://www.finlab.tw/wp-content/uploads/2022/12/newplot-45-1024x291.png 1024w, https://www.finlab.tw/wp-content/uploads/2022/12/newplot-45-300x85.png 300w, https://www.finlab.tw/wp-content/uploads/2022/12/newplot-45-768x218.png 768w, https://www.finlab.tw/wp-content/uploads/2022/12/newplot-45-1536x437.png 1536w, https://www.finlab.tw/wp-content/uploads/2022/12/newplot-45.png 1847w" sizes="(max-width: 1024px) 100vw, 1024px" title="技術指標教室｜動量指標 AROON 2"></figure>



<p class="has-medium-font-size">aroonup &gt; aroondown 的條件回測效果最好，但年化報酬只有6%，同樣都是股價創新高的動能因子，AROON指標跟先前介紹的「<a href="https://www.finlab.tw/breakthrough_stock_picking_strategies/">創新高延續度動能策略</a>」相比，實在遜色太多，若依照市場一般的參數使用，無法得到太好的效果，有帶進一步的優化研究。</p>



<h2>相關資源</h2>



<ul class="has-medium-font-size"><li><a href="https://colab.research.google.com/drive/1pEUO_YxJPgvHB5Qk1jT7rvIgIb8HQkN5?usp=sharing" target="_blank" rel="noopener">colab範例檔</a></li><li><a href="https://wizardforcel.gitbooks.io/python-quant-uqer/content/78.html" target="_blank" rel="noopener">阿隆指标 • 技术指标阿隆（ Aroon ）全解析</a></li></ul>



<h2><br></h2>
]]></content:encoded>
					
					<wfw:commentRss>https://www.finlab.tw/aroon_indicator/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">4979</post-id>	</item>
	</channel>
</rss>
