開倉條件:如果15天的移動平均線大于30天均線,并且30天均線大于45天平均線,即開倉
平倉條件:
1、如果價格上漲,漲幅達到開倉價格的7%時,平倉一半(在K線上標注“減倉”)
2、當漲幅達到10%時平倉另一半(在K線上標注“平倉”)
3、如果價格下跌,當價格跌到開倉價的7%時平倉
ma15:ma(c,15);
ma30:ma(c,30);
ma45:ma(c,45);
input:n(2,1,100,1);
if ma15>ma30 and ma30>ma45 then buy(holding=0,n,market);
if (h-enterprice)/enterprice>=0.07 and (h-enterprice)/enterprice<0.10 then 減倉:sell(1,holding/2,market);
if (h-enterprice)/enterprice>=0.10 then 平倉:sell(1,holding/2,market);
if (enterprice-l)/enterprice<0.07 then sell(1,0,market);