請問;當(dāng)根K棒的成交量與10日均量比值第二次大於2.3時則賣出;要怎么寫程式
?
var: ma_volume(0), count(0);
ma_volume=averagefc(ticks,10);
if ma_volume<>0 then
condition1=ticks/ma_volume>2.3;
if condition1 then
count=count+1;
if count=2 then
sellshort next bar at market;
注意事項:
1. ma_volume表示10日均量,condition1表示當(dāng)根bar的成交量與10日均量比值大于2.3的條件
2. 變量count用于統(tǒng)計condition1第幾次成立
3. 當(dāng)count為2時執(zhí)行賣空的操作(若是賣出平倉,則使用sell語句)