小幫手您好:
以下是我的指標內容
var: pre_high(0); var: xWindows(0); xWindows =ceiling(timeDiff(currentTime, 090000, "M")); pre_high = mySwingHigh(high, xWindows, 1, 1, 1); plot1(pre_high, "pre_high");
想要在主圖疊圖上找到當天的前高位置
但在盤中會發生畫不出最新位置的線,然後盤後所有的線也都畫不出來,想請問是有哪個地方寫錯了嗎
小幫手您好:
以下是我的指標內容
var: pre_high(0); var: xWindows(0); xWindows =ceiling(timeDiff(currentTime, 090000, "M")); pre_high = mySwingHigh(high, xWindows, 1, 1, 1); plot1(pre_high, "pre_high");
想要在主圖疊圖上找到當天的前高位置
但在盤中會發生畫不出最新位置的線,然後盤後所有的線也都畫不出來,想請問是有哪個地方寫錯了嗎
Hello 龍槍,
需要麻煩您一併提供 mySwingHigh 函數讓小幫手測試。
另外,您的xWindows看起來是在計算開盤到當下過了幾根Bar。
可以使用變數紀錄即可,效率應該會比較好。
舉例來說:
if getfielddate("Date") <> getfielddate("Date")[1] then value1 = 1 else value1 += 1;
這樣value1就會是開盤到當下的Bar數量。
小幫手你好,
myswinghigh,其實就是內建指標的swinghigh,這邊只是練習改寫成自訂函數而已
另外謝謝建議對於開盤到當下過幾根bar的寫法
Hello 龍槍,
如果您的 myswinghigh 等於 swinghigh 的話,只要將 xWindows 裡的 currenttime 修改為 time 即可。
因為currenttime的掛上去時過去的資料會是當下的時間。
或是如果您使用小幫手上面建議的 if getfielddate("Date") <> getfielddate("Date")[1] then value1 = 1 else value1 += 1; 也可以正常畫出。
3 評論