当前位置:分析家公式网 → 股票公式 → 开拓者公式 → 一键转帖:开拓者 TB海龟交易系统源码及评论
软件名称:[B]开拓者 TB海龟交易系统源码及评论[/B]
软件类型:国产软件
运行环境:Win2000/WinXP/Win2003/WinVista
软件语言:简体中文
授权方式:共享软件
软件大小:0 Bytes
官方主页:Home Page
更新时间:2013-03-01 04:40:55
软件简介:
- 咨询内容: 本帖最后由 slarkmonk 于 2011-8-16 15:09 编辑
Question1:
我用的是交易开拓者旗舰版V4,最近几天在研究上面的海龟交易系统源码,请问上面自带的海龟源码是不是最新的?有没有经过测试啊?我看论坛置顶区里面那里写的最新源码和我的不一样,去网上搜索也不知道哪个是最新、而且没有问题能运行的....
求解!
多谢!
附上软件上的源码
//------------------------------------------------------------------------
// 简称: TurtleTrader
// 名称: 海龟交易系统
// 类别: 公式应用
// 类型: 内建应用
//------------------------------------------------------------------------
Params
Numeric RiskRatio(1); // % Risk Per N ( 0 - 100)
Numeric ATRLength(20); // 平均波动周期 ATR Length
Numeric boLength(20); // 短周期 BreakOut Length
Numeric fsLength(55); // 长周期 FailSafe Length
Numeric teLength(10); // 离市周期 Trailing Exit Length
Bool LastProfitableTradeFilter(True); // 使用入市过滤条件
Vars
Numeric MinPoint; // 最小变动单位
NumericSeries AvgTR; // ATR
Numeric N; // N 值
Numeric TotalEquity; // 按最新收盘价计算出的总资产
Numeric TurtleUnits; // 交易单位
NumericSeries DonchianHi; // 唐奇安通道上轨,延后1个Bar
NumericSeries DonchianLo; // 唐奇安通道下轨,延后1个Bar
NumericSeries fsDonchianHi; // 唐奇安通道上轨,延后1个Bar,长周期
NumericSeries fsDonchianLo; // 唐奇安通道下轨,延后1个Bar,长周期
Numeric ExitHighestPrice; // 离市时判断需要的N周期最高价
Numeric ExitLowestPrice; // 离市时判断需要的N周期最低价
Numeric myEntryPrice; // 开仓价咯
Numeric myExitPrice; // 平仓价咯
Bool SendOrderThisBar(False); // 当前Bar有过交易
NumericSeries preEntryPrice(0); // 前一次开仓的价咯
BoolSeries PreBreakoutFailure(false); // 前一次突破是否失败
Begin
If(BarStatus == 0)
{
preEntryPrice = InvalidNumeric;
PreBreakoutFailure = false;
}
MinPoint = MinMove*PriceScale;
AvgTR = XAverage(TrueRange,ATRLength);
N = AvgTR[1];
TotalEquity = Portfolio_CurrentCapital() + Portfolio_UsedMargin();
TurtleUnits = (TotalEquity*RiskRatio/100) /(N * ContractUnit()*BigPointValue());
TurtleUnits = IntPart(TurtleUnits); // 对小数取整
DonchianHi = HighestFC(High[1],boLength);
DonchianLo = LowestFC(Low[1],boLength);
fsDonchianHi = HighestFC(High[1],fsLength);
fsDonchianLo = LowestFC(Low[1],fsLength);
ExitLowestPrice = LowestFC(Low[1],teLength);
ExitHighestPrice = HighestFC(High[1],teLength);
Commentary("N="+Text(N));
Commentary("preEntryPrice="+Text(preEntryPrice));
Commentary("PreBreakoutFailure="+IIFString(PreBreakoutFailure,"True","False"));
// 当不使用过滤条件,或者使用过滤条件并且条件为PreBreakoutFailure为True进行后续操作
If(MarketPosition == 0 && ((!LastProfitableTradeFilter) Or (PreBreakoutFailure)))
{
// 突破开仓
If(High > DonchianHi && TurtleUnits >= 1)
{
// 开仓价咯取突破上轨+一个价位和最高价之间的较小值,这样能更接近真实情况,并能尽量保证成交
myEntryPrice = min(high,DonchianHi + MinPoint);
myEntryPrice = IIF(myEntryPrice < Open, Open,myEntryPrice); // 大跳空的时候用开盘价代替
preEntryPrice = myEntryPrice;
Buy(TurtleUnits,myEntryPrice);
SendOrderThisBar = True;
PreBreakoutFailure = False;
}
If(Low < DonchianLo && TurtleUnits >= 1)
{
// 开仓价咯取突破下轨-一个价位和最低价之间的较大值,这样能更接近真实情况,并能尽量保证成交
myEntryPrice = max(low,DonchianLo - MinPoint);
myEntryPrice = IIF(myEntryPrice > Open, Open,myEntryPrice); // 大跳空的时候用开盘价代替
&n
[url=http://www.70822.com/soft/sort013/sort083/down-59432.html]开拓者 TB海龟交易系统源码及评论[/url]