包寧傑帶狀操作法 - 財經

Table of Contents

Parameter: UpColor(Red), DnColor(Green), CompBars(6),FastMA(10),SlowMA(20),MacdMA(9)
Variables: haClose(0), haOpen(0), haHigh(0), haLow(0), color(0),value1(0)

value2=MACD(close,FastMA,SlowMA)
value3= EMA(value1,MacdMA)
value4=value2-value1

If BarNumber = 1 then
haOpen = open
haClose = (Open + High + Low + Close) / 4
haHigh = MaxList( high, haOpen, haClose)
haLow = MinList( low, haOpen, haClose)
End If

if BarNumber > 1 then
haClose = (Open + High + Low + Close) / 4
haOpen = (haOpen [1] + haClose [1]) / 2
haHigh = MaxList(High, haOpen, haClose)
haLow = MinList(Low, haOpen, haClose)

if haClose > haOpen then
color = UpColor
else
color = DnColor
End If

for value1 = 1 to CompBars
if haOpen <= MaxList(haOpen[value1], haClose[value1]) and
haOpen >= MinList(haOpen[value1], haClose[value1]) and
haClose <= MaxList(haOpen[value1], haClose[value1]) and
haClose >= MinList(haOpen[value1], haClose[value1]) then
color = color[value1]
End If
End For

If Color = UpColor And Value1 Cross Over 0 And CurrentContracts <= 0 Then
buy("買進") next bar at market
End If

If Color = DnColor and value4<-20 And CurrentContracts >= 0 Then
sell("賣出") next bar at market
End If

end If


想請問一下大家,這份程式碼還需要加上些什麼東西?

--

All Comments

Margaret avatarMargaret2008-08-29
請問你想問什麼?
Thomas avatarThomas2008-09-01
你的MACD的式子,value1,2,3,不用刻意改成2,3,4
Carol avatarCarol2008-09-06
看的懂的人還是看得懂,看不懂的人還是看不懂!