開拓者 TB 三均線交易系統(tǒng),請(qǐng)大家和高手修改、完善、提升[開拓者公式]
- 三均線系統(tǒng)語言
一、 模型構(gòu)想:小時(shí)圖
三個(gè)簡(jiǎn)單移動(dòng)平均作比較,4小時(shí),9小時(shí),18小時(shí)。
① 買入:4小時(shí)均線上穿18小時(shí)均線;
② 賣出:4小時(shí)均線下穿18小時(shí)均線。
二、 模型文字語言
1. 開、平倉(cāng)條件
(1)當(dāng)前無持倉(cāng)
a. 當(dāng)4小時(shí)均線上穿18小時(shí)均線;下一根K線以開盤價(jià)開多倉(cāng);
b. 當(dāng)4小時(shí)均線下穿18小時(shí)均線;下一根K線以開盤價(jià)開空倉(cāng)。
(2)當(dāng)前持多倉(cāng)
a. 4小時(shí)均線下穿9小時(shí)均線,下一根K線以開盤價(jià)平倉(cāng)。
(3)當(dāng)前持空倉(cāng)
a. 4小時(shí)均線上穿9小時(shí)均線,下一根K線以開盤價(jià)平倉(cāng)。
2. 持倉(cāng)數(shù)量:為總資金的30%
3. 沒有止損
三、 模型語言編輯(源代碼):
Params
Numeric FourLength(4); //短期均線參數(shù)4
Numeric NineLength(9); //短期均線參數(shù)9
Numeric EighteenLength(18); //短期均線參數(shù)18
Vars
NumericSeries MA4; //短期均線4
NumericSeries MA9; //短期均線9
NumericSeries MA18; //短期均線18
Numeric TradeUnits; //可交易的合約數(shù)量
Numeric Trademoney; //允許交易的金額
Numeric Contractprice; //單張合約金額
Begin
MA4 = Average(Close, FourLength);
MA9 = Average(Close, NineLength);
MA18 = Average(Close, EighteenLength);
If(MarketPosition == 0) //無倉(cāng)位
{
Trademoney = 0.3*CurrentCapital();
Contractprice = ContractUnit*nextopen;
TradeUnits = IntPart(Trademoney/Contractprice);
If(crossover(MA4,MA18)) // 4小時(shí)均線上穿18小時(shí)均線
{
Buy(TradeUnits, nextopen, true); //開多倉(cāng)
SetGlobalVar(0, nextopen);
}Else If(crossunder(MA4,MA18)) // 4小時(shí)均線下穿18小時(shí)均線
{
SellShort(TradeUnits, nextopen, true); //開空倉(cāng)
SetGlobalVar(1, nextopen);
}
}Else IF(MarketPosition == 1) //有多倉(cāng)
{
If(crossunder(MA4,MA9)) //4小時(shí)均線下穿9小時(shí)均線
{
sell(TradeUnits, nextopen, true);//平多倉(cāng)
}
}Else IF (MarketPosition == -1) //有空倉(cāng)
{
If(crossover(MA4,MA9)) // 4小時(shí)均線上穿9小時(shí)均線
{
BuyToCover(TradeUnits, nextopen, true);//平空倉(cāng)
}
}
End
有思路,想編寫各種指標(biāo)公式,程序化交易模型,選股公式,預(yù)警公式的朋友
可聯(lián)系技術(shù)人員 QQ: 262069696 進(jìn)行 有償 編寫!(不貴!點(diǎn)擊查看價(jià)格!)
相關(guān)文章
-
沒有相關(guān)內(nèi)容