平靜的海 發表於 17-5-3 02:01

請問寫法

在寫程式的過程中
我常用c cross above    avg(close,5)then ......//意思是 當根K棒的收盤價向上穿越均線5
但實際會看到的發生情況很可能是"跳空"的結果 並非是"一根"K棒 而只是一個"直接"穿越過的價位
可能的情況是
1.開盤與收盤皆為同一價並高於均線5
2.直接開高


口語的說法是 開盤價在均線5之下 收盤價在均線5之上 此根K棒穿越均線5 (這個是我想要的)

如何去改進的寫法或是描述??



goodddog 發表於 17-5-3 07:43

O<average(C,5) and C>average(C,5)

splendor 發表於 17-5-3 11:28

var: ma(0);
ma = Average(close,5);
if c cross above ma or (c<ma and c>ma)then.....

是這樣嗎?

平靜的海 發表於 17-5-3 12:08

splendor 發表於 17-5-3 11:28
var: ma(0);
ma = Average(close,5);
if c cross above ma or (cma)then.....


splendor寫的是對的 您可參考


您寫的 if c cross above ma   //這樣非常有可能是跳空

頁: [1]
查看完整版本: 請問寫法