- 精华
- 0
- 在线时间
- 466 小时
- UID
- 110420
- 积分
- 547
- 帖子
- 326
- 阅读权限
- 50
- 注册时间
- 2012-5-11
- 最后登录
- 2019-1-11
- 精华
- 0
- UID
- 110420
- 积分
- 547
- 帖子
- 326
- 主题
- 16
- 阅读权限
- 50
- 注册时间
- 2012-5-11
- 最后登录
- 2019-1-11
|
本帖最后由 受伤的小鱼 于 2012-12-23 13:56 编辑
受伤的小鱼 发表于 2012-12-23 12:47
接下来的这个交易同样发生了诸如5.20的情况,如果提前止损,也可能也错失行情,
...
在加止损代码前,我还是把多空的交易分开两个程序来写,我承认我所做的一切其最终行为目的其实是拟合曲线!!!举个例子,当5.20的情况发生,在这个过程中因为使用了多空不对称的参数!!!可能会达到对冲的结果!那么“提高最大使用资金的初衷”实现了。。。。。。。,那么先写多头的吧!!!
Params
Numeric atrlen(17);
Numeric atrvl(1.8);
Numeric atrvs(1.1);
Numeric stlfd(100);
Vars
Numeric offs;
NumericSeries atr;
Numeric uprail;
Numeric lorail;
Numeric lprice;
Numeric sprice;
BoolSeries entry01;
BoolSeries exit01;
BoolSeries exit02;
Numeric stlpr;
Begin
offs=MinMove*PriceScale;
atr=Average(h-l,atrlen);
uprail=open+atrvl*atr[1];
lorail=open-atrvs*atr[1];
lprice=uprail+2*offs;
sprice=lorail-2*offs;
stlpr=Min(open,LastEntryPrice*(1-stlfd/1000))-2*offs;
entry01=high>uprail;
Exit01 =low <lorail;
exit02 =low <LastEntryPrice*(1-stlfd/1000);
if (MarketPosition<>1 and entry01 ) Buy(0,lprice);
if (MarketPosition==1 and exit01 ) Sell(0,sprice);
if (exit02 ) Sell(0,stlpr);
//Commentary("swag"+Text(CountIf (entryl01 and entrys01,CurrentBar)));
end同样,因为语序的问题止损行为写在开仓之前,就等于说此策略的开仓BAR是不进行幅度止损的(晕死,4.3.2版本怎么一样的,先继续写先)
而在对止损幅度进行优化时,以结果论历史行情确实说明了“扛得浮亏,终成正果。。。。。。。。。”(这也是我从来不采用幅度止损的原因。。。。。。。于是我以后会说我从来不做交易。。。。。。)再次优化1,2,3个参数,抽根烟去先 |
附件: 你需要登录才可以下载或查看附件。没有帐号?注册
|