開拓者棉花套利策略源碼[開拓者公式]
- 源碼內(nèi)容
Params
Numeric uprice1(700);
Numeric uprice2(750);
Numeric uprice3(800);
Numeric dprice1(-700);
Numeric dprice2(-750);
Numeric dprice3(-800);
Numeric lots1(1);
Numeric lots2(2);
Numeric lots3(4);
Vars
Numeric NO1(0);
Numeric M;
Numeric M1;
NumericSeries buyprice;
NumericSeries sellprice;
BoolSeries Upline;
BoolSeries Upline1;
BoolSeries Upline2;
BoolSeries downline;
BoolSeries downline1;
BoolSeries downline2;
Begin
M=Data0.close-Data1.close;
M1=(Data0.open)-(Data1.open);
//PlotNumeric("M",M);
//PlotNumeric("M1",M1);
upline=CrossOver(M,uprice1);
upline1=CrossOver(M,uprice2);
upline2=CrossOver(M,uprice3);
downline=CrossUnder(M,dprice1);
downline1=CrossUnder(M,dprice2);
downline2=CrossUnder(M,dprice3);
//M>700的時(shí)候開倉(cāng)加倉(cāng)
If(data0.MarketPosition !=-1 and (upline==true))
{
data0.SellShort(lots1,data0.close);
data1.buy(lots1,data0.close);
}
If(data0.MarketPosition==-1 and (upline1==true))
{
data0.SellShort(lots2,data0.close);
data1.buy(lots2,data1.close);
}//來源:www.tumamayizhan.com //
If(data0.MarketPosition==-1 and (upline2==true))
{
data0.SellShort(lots3,data0.close);
data1.buy(lots3,data1.close);
}
//M<700的時(shí)候開倉(cāng)加倉(cāng)
If(data0.MarketPosition!=1 and (downline==true) )
{data0.buy(lots1,data0.close);
data1.SellShort(lots1,data1.close);
}
If(data0.MarketPosition==1 and (downline1==true) )
{data0.buy(lots2,data0.close);
data1.SellShort(lots2,data1.close);
}
If(data0.MarketPosition==1 and (downline2==true) )
{data0.buy(lots3,data0.close);
data1.SellShort(lots3,data1.close);
}
End
//來源:www.tumamayizhan.com //
有思路,想編寫各種指標(biāo)公式,程序化交易模型,選股公式,預(yù)警公式的朋友
可聯(lián)系技術(shù)人員 QQ: 262069696 進(jìn)行 有償 編寫!(不貴!點(diǎn)擊查看價(jià)格!)
相關(guān)文章
-
沒有相關(guān)內(nèi)容