開(kāi)拓者 TB ssto 交易系統(tǒng)策略源碼[開(kāi)拓者公式]
- //------------------------------------------------------------------------
// 簡(jiǎn)稱(chēng): ssto
// 名稱(chēng):
// 類(lèi)別: 公式應(yīng)用
// 類(lèi)型: 用戶應(yīng)用
// 輸出:
//------------------------------------------------------------------------
Params
Numeric Length(20); //N
Numeric SlowLength(24); //M1
Numeric SmoothLength(10); //M2
Numeric LongLength(20);
Numeric lots(1);
Numeric offset(0);
Numeric stoploss(50);
Vars
NumericSeries HighestValue;
NumericSeries LowestValue;
NumericSeries RSV;
NumericSeries FASTK;
NumericSeries K1;
NumericSeries D1;
Numeric i_offset;
Numeric BuyPosition;
Numeric SellPosition;
Numeric myEntryPrice;
Numeric myExitPrice;
Begin
HighestValue = HighestFC(High, Length);
LowestValue = LowestFC(Low, Length);
RSV = (Close-LowestValue)/(HighestValue-LowestValue)*100;
FASTK = SMA(RSV,SlowLength,1);
K1 = SMA(FASTK,SmoothLength,1);
D1 = SMA(K1,LongLength,1);
i_offset = offset*MinMove*PriceScale;
if(MarketPosition == 0)
{
if(CrossOver(K1,D1))
{
buy(lots,Close[1]);
Return;
}
//if(CrossUnder(K1,D1))//開(kāi)空頭
//{
// SellShort(lots,Close[1]);
// Return;
//}
}
if(MarketPosition == 1)//平多
{
if(CrossUnder(K1,D1))
{
Sell(lots,Close);
Return;
}
}
//止損
If(MarketPosition == 1)
{
If(Low < EntryPrice - StopLoss * MinMove*PriceScale)
{
myExitPrice = EntryPrice - (StopLoss+1) * MinMove*PriceScale;
myExitPrice = max(low,myExitPrice);
Sell(lots,myExitPrice);
}
}
Else If(MarketPosition == -1)
{
If(High > EntryPrice + StopLoss * MinMove*PriceScale)
{
myExitPrice = EntryPrice + (StopLoss+1) * MinMove*PriceScale;
myExitPrice = min(high,myExitPrice);
BuyToCover(lots,myExitPrice);
}
}
end
//------------------------------------------------------------------------
// 編譯版本 GS2010.12.08
// 用戶版本 2013/02/21 23:49
// 版權(quán)所有 woomin
// 更改聲明 TradeBlazer Software保留對(duì)TradeBlazer平臺(tái)
// 每一版本的TrabeBlazer公式修改和重寫(xiě)的權(quán)利
//------------------------------------------------------------------------
有思路,想編寫(xiě)各種指標(biāo)公式,程序化交易模型,選股公式,預(yù)警公式的朋友
可聯(lián)系技術(shù)人員 QQ: 262069696 進(jìn)行 有償 編寫(xiě)!(不貴!點(diǎn)擊查看價(jià)格!)
相關(guān)文章
-
沒(méi)有相關(guān)內(nèi)容