關於OBV

  •   252 
  • 最後發表   zzor00194  2021 八月 21
zzor00194 發文於   2021/08/19

不好意思,剛學習XS 請教一下我寫的OBV

 

input: MAOBV1(26);

SetInputName(1, "天數");

variable: obvolume(0);

 

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;

 

Plot1(obvolume, "OBV");

 

運作是正常的

那麼想請教,如果我要標示今天的OBV創了近期XX天新高有辦法寫嗎?

排序方式: 標準 | 最新
XQ小幫手 發文於   2021/08/20

Hello zzor00194,

 

最簡單的方法是您可以先使用 SimpleHighest 篩選出近N根Bar最高值,然後在以此值與當根Bar的值作比較。

如果相等的話該Bar就是近N根Bar中最高的。

附上指標腳本供您參考。

附加文件

  • 按讚來自於
  • zzor00194
zzor00194 發文於   2021/08/21

感謝教學!! 出來了!! 繼續來學習!!

發表回覆
Close