如果10:00的收盤價>開盤價>9:45的前的最高價,我想秀出圖示在畫面上,程式這樣寫,有那裡錯誤嗎?
if time = 100000 then value1 = getfield("收盤價", "15");
if time <= 094500 then value2 = getfield("High", "D");
value3 = getfield("open", "D");
if value1>value2 and value1>value3 then plot2(1,"多方訊號");
如果10:00的收盤價>開盤價>9:45的前的最高價,我想秀出圖示在畫面上,程式這樣寫,有那裡錯誤嗎?
if time = 100000 then value1 = getfield("收盤價", "15");
if time <= 094500 then value2 = getfield("High", "D");
value3 = getfield("open", "D");
if value1>value2 and value1>value3 then plot2(1,"多方訊號");
Hello tseng ching,
請注意XQ的 time 是Bar開始的時間,所以舉例來說若您使用1分鐘頻率的話 100000 就會是 10:00 到 10:01 間的資料。
所以文章腳本中的time需要考慮這一點來作變更。
另外,由於您要在當日的10點以後才能取到10點的收盤價,故會建議您在plot的時候最快也要在10點或以後畫出,這樣 value1 ~ value3 才會是正確的對應數值。
若只希望畫出一個點,那麼就限定plot的時間在10點 (ex. if value1>value2 and value1>value3 and time = 100000 then plot2(1,"多方訊號");)。
1 評論