小幫手 你好,
我想請問選股策略裡能不能截取到 OBV值以及OBV的五均與20均。技術分析副圖量能指標裡就可設定出現OBV曲線,肯定系統裡確已存在OBV資料,不知在編寫選股策略時如何能取得OBV資料?
系統提供的OBV指標部份內容如下,你只要加上setTotalBar(300)及OBV要怎麼樣才符合條件,即可選出股票,其中obvolume就是OBV,obvSMA及obvMMA分別為OBV的5均及20均。
setTotalBar(300);
input:SMAlength(5,"OBV的短MA期數"), MMAlength(20,"OBV的中MA期數");
variable: obvolume(0), obvSMA(0), obvSMA_Str(""), obvMMA(0), obvMMA_Str("");
if CurrentBar = 1 then
obvolume = 0
else
begin
if close > close[1] then
obvolume = obvolume[1] + volume
else
begin
if close < close[1] then
obvolume = obvolume[1] - volume
else
obvolume = obvolume[1];
end;
end;
obvSMA = average(obvolume,SMAlength);
obvMMA = average(obvolume,MMAlength);
感謝 許教授 詳細回復. 但尚有一點疑惑 , 樓上 codes 沒有設定頻率 不知是否自行採用日線頻率?
這個腳本若當作選股腳本,則頻率要設為日以上的頻率。若是警示或交易腳本,則任何頻率都可以。
瞭解, 再次感謝 許教授.
系統提供的OBV指標部份內容如下,你只要加上setTotalBar(300)及OBV要怎麼樣才符合條件,即可選出股票,其中obvolume就是OBV,obvSMA及obvMMA分別為OBV的5均及20均。
setTotalBar(300);
input:SMAlength(5,"OBV的短MA期數"), MMAlength(20,"OBV的中MA期數");
variable: obvolume(0), obvSMA(0), obvSMA_Str(""), obvMMA(0), obvMMA_Str("");
if CurrentBar = 1 then
obvolume = 0
else
begin
if close > close[1] then
obvolume = obvolume[1] + volume
else
begin
if close < close[1] then
obvolume = obvolume[1] - volume
else
obvolume = obvolume[1];
end;
end;
obvSMA = average(obvolume,SMAlength);
obvMMA = average(obvolume,MMAlength);
使用這段代碼, 得出的 OBV 值和 XQ技術分析副圖量 OBV能指標值不一樣.
XQ技術分析副圖量 OBV能指標值到底是如何算出?
算法其實一樣,指標數值之所以不一樣,原因是開始計算的第一根K棒不同 ,最後累計的結果自然不同,但若看OBV走勢圖其實是一樣的。。
6 評論