 |
8QptCEM9
初級會員

註冊日期: Mar 2022
來 自: 台灣
文章數量: 19 |
|
[公式]IFF指令請益
在TradingView的Pine語言中,up1 = nz(up[1],up),其中nz表示以系列中的零(或指定值)替換NaN值。
語法:
nz(x, y) → integer
nz(x, y) → float
nz(x, y) → color
nz(x, y) → bool
nz(x, y) → series[integer]
nz(x, y) → series[float]
nz(x, y) → series[color]
nz(x, y) → series[bool]
nz(x) → integer
nz(x) → float
nz(x) → color
nz(x) → bool
nz(x) → series[integer]
nz(x) → series[float]
nz(x) → series[color]
nz(x) → series[bool]
參數:
x (series) 待執行的系列值。
y (float) 將插入的值代替x系列中的所有NaN值。
請問如果我想用奇狐語法實現up1 = nz(up[1],up),我可以怎麼做呢?感覺是用IFF指令但是IFF是返回零值,而前述nz指令則可以返回零值與na值。
|
|
向版主報告此篇 |  |
|
2023-09-08 17:57 |
|
|
|  |
 |
cgjj
總版主

註冊日期: Oct 2003
來 自:
文章數量: 18251 |
|
回覆: [公式]IFF指令請益
引用: 最初由 8QptCEM9 發表
在TradingView的Pine語言中,up1 = nz(up[1],up),其中nz表示以系列中的零(或指定值)替換NaN值。
語法:
nz(x, y) → integer
nz(x, y) → float
nz(x, y) → color
nz(x, y) → bool
nz(x, y) → series[integer]
nz(x, y) → series[float]
nz(x, y) → series[color]
nz(x, y) → series[bool]
nz(x) → integer
nz(x) → float
nz(x) → color
nz(x) → bool
nz(x) → series[integer]
nz(x) → series[float]
nz(x) → series[color]
nz(x) → series[bool]
參數:
x (series) 待執行的系列值。
y (float) 將插入的值代替x系列中的所有NaN值。
請問如果我想用奇狐語法實現up1 = nz(up[1],up),我可以怎麼做呢?感覺是用IFF指令但是IFF是返回零值,而前述nz指令則可以返回零值與na值。
不同軟體語言的運算基礎架構未必相同
架構不同要算相同的東西
在程式語言撰寫處理上,就可能會有很大的差異~~
我想以下可能是您想要的答案吧,請參考!!!
以均線舉例來說~~
MM:MA(C,30);
MM 這個均線其數列的有效起始位置是 30,也就是 lbound(MM)=30
MM 這個數列在K棒第1根~第29根為無效區域
若要將 MM 無效的區域設為零值,做法如下:
MM:=if(barpos>=LBOUND(MM) and LBOUND(MM)>0,MM,0);
較好的做法,是理解原理後,重新用奇狐寫過
而非一行一行想去轉換翻譯為奇狐的語法
|
|
向版主報告此篇 |  |
|
2023-09-08 19:28 |
|
|
|  |
本站所有內容未經作者授權禁止轉貼節錄, 發表言論僅供參考勿作為投資決策依據。瀏覽本站請使用 IE 5.5 以上版本, 最佳瀏覽解析度 1024 x 768 全彩。
|
Powered by: vBulletin Version 2.3.0 - Copyright©2000-, Jelsoft Enterprises Limited.
簡愛洋行 製作 Copyright 2003-. All Rights Reserved. 聯絡我們
|