請(qǐng)問(wèn);當(dāng)根K棒的成交量與10日均量比值第二次大於2.3時(shí)則賣(mài)出;要怎么寫(xiě)程式
?
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;
注意事項(xiàng):
1. ma_volume表示10日均量,condition1表示當(dāng)根bar的成交量與10日均量比值大于2.3的條件
2. 變量count用于統(tǒng)計(jì)condition1第幾次成立
3. 當(dāng)count為2時(shí)執(zhí)行賣(mài)空的操作(若是賣(mài)出平倉(cāng),則使用sell語(yǔ)句)