OmegaChartでボリンジャーバンド±1〜3σを描画する方法。
■default.omegaを書き換える前に必ずバックアップをとっておいて下さい。
■まず、default.omegaの下の方にある<!-- Library -->のところに以下の赤文字のように追加します。
<!-- Library -->
<library
name="bb_sdev">
<expression>sdev(close({0}) -
MA({0}))</expression>
</library>
<library
name="ue_hige">
<expression><![CDATA[high()/max(open(),close()) >
1.01]]></expression>
</library>
(以下略)
■次にdefault.omegaの上の方にあるボリンジャーバンドに関する記述を書き換えます。
<indicator
target="price"
count="2"
name="bb_sdev"
display="explanation">
<expression>sdev(close({0}) -
MA({0}))</expression>
<title>ボリンジャーバンド</title>
<header>{0}ボリンジャー</header>
<description>過去の一定期間の平均に対する標準偏差の2倍を上下に描画した線です。
上に抜けた状態は買われすぎ、下に抜けた状態は売られすぎを示すとされています。</description>
<param index="0" type="positiveInteger">
<daily unit="日" default="25"/>
<weekly unit="週"
default="13"/>
<monthly unit="月"
default="13"/>
</param>
<defaultappearance style="Dotted" color="Peru"/>
</indicator>
<indicator
target="price"
name="bb_u"
display="value+chart"
depends="bb_sdev">
<expression>MA({0})+2*bb_sdev({0})</expression>
<header>{0}MA+2σ</header>
</indicator>
<indicator
target="price"
name="bb_d"
display="value+chart"
depends="bb_sdev">
<expression>MA({0})-
2*bb_sdev({0})</expression>
<header>{0}MA-2σ</header>
</indicator>
上記の部分を削除して
<indicator
target="price"
name="bb_u3"
display="value+chart">
<expression>MA({0})+3*bb_sdev({0})</expression>
<title>ボリンジャーバンド±3σ</title>
<description>過去の一定期間の平均に対する標準偏差の3倍を上下に描画した線です。</description>
<header>{0}MA+3σ</header>
<param index="0"
type="positiveInteger">
<daily unit="日" default="25"/>
<weekly unit="週"
default="13"/>
<monthly unit="月"
default="13"/>
</param>
<defaultappearance style="Dotted" color="Peru"/>
</indicator>
<indicator
target="price"
name="bb_u"
display="value+chart">
<expression>MA({0})+2*bb_sdev({0})</expression>
<title>ボリンジャーバンド±2σ</title>
<description>過去の一定期間の平均に対する標準偏差の2倍を上下に描画した線です。
上に抜けた状態は買われすぎ、下に抜けた状態は売られすぎを示すとされています。</description>
<header>{0}MA+2σ</header>
<param index="0"
type="positiveInteger">
<daily unit="日" default="25"/>
<weekly unit="週"
default="13"/>
<monthly unit="月"
default="13"/>
</param>
<defaultappearance style="Dotted" color="Peru"/>
</indicator>
<indicator
target="price"
name="bb_u1"
display="value+chart">
<expression>MA({0})+bb_sdev({0})</expression>
<title>ボリンジャーバンド±1σ</title>
<description>過去の一定期間の平均に対する標準偏差の1倍を上下に描画した線です。</description>
<header>{0}MA+1σ</header>
<param index="0"
type="positiveInteger">
<daily unit="日" default="25"/>
<weekly unit="週"
default="13"/>
<monthly unit="月"
default="13"/>
</param>
<defaultappearance style="Dotted" color="Peru"/>
</indicator>
<indicator
target="price"
name="bb_d1"
display="value+chart"
depends="bb_u1">
<expression>MA({0})-
bb_sdev({0})</expression>
<header>{0}MA-1σ</header>
</indicator>
<indicator
target="price"
name="bb_d"
display="value+chart"
depends="bb_u">
<expression>MA({0})-
2*bb_sdev({0})</expression>
<header>{0}MA-2σ</header>
</indicator>
<indicator
target="price"
name="bb_d3"
display="value+chart"
depends="bb_u3">
<expression>MA({0})-
3*bb_sdev({0})</expression>
<header>{0}MA-3σ</header>
</indicator>
このように書きます。
bb_sdevをlibraryで定義しているのと、bb_u、bb_dはnameも計算式も変わっていないので、それらを使ったスクリーニングなどには影響しないはずですが、自己責任でお願いします。
SEO | [PR] 爆速!無料ブログ 無料ホームページ開設 無料ライブ放送 | ||