close

 

以下介紹得分制語法

假如我們有1、2、3、4共四個條件,當每個條件成立時得1分

假設我們假設分數大於等於3時,就買進,當分數小於等於1時就賣出

語法如下:

var:score(0)
condition1=average(close,5)>average(close,5)[1]
condition2=average(close,50)>average(close,50)[1]
condition3=average(close,100)>average(close,100)[1]
condition4=average(close,200)>average(close,200)[1]

 

score=0

if condition1 then
score=score+1               (當條件1成立時+1分)
end if

if condition2 then
score=score+1               (當條件2成立時+1分)
end if

if condition3 then
score=score+1               (當條件3成立時+1分)
end if

if condition4 then
score=score+1               (當條件4成立時+1分)
end if

 

if score>=3 then            (當總分大於等於3分時)
buy next bar at market
end if

if score<=1 then            (當總分小於等於1分時)
sell next bar at market
end if

 

arrow
arrow
    全站熱搜

    阿豪 發表在 痞客邦 留言(0) 人氣()