- 精华
- 0
- 在线时间
- 335 小时
- UID
- 112550
- 积分
- 263
- 帖子
- 89
- 阅读权限
- 50
- 注册时间
- 2012-9-17
- 最后登录
- 2022-1-19
- 精华
- 0
- UID
- 112550
- 积分
- 263
- 帖子
- 89
- 主题
- 14
- 阅读权限
- 50
- 注册时间
- 2012-9-17
- 最后登录
- 2022-1-19
|
代码如下:
Vars
Numeric MinPoint;//一个最小变动单位,也就是一跳
NumericSeries firstPrice;//第一次开仓价格
NumericSeries LastPrice;//最后一次开仓价格
Numeric AddSet(30);//加仓设置
Numeric SubSet(30);//减仓设置
Bool FirstEntryCon;//首次开仓条件lazer公式开发指南加仓减仓
-109-
Begin
FirstEntryCon=...
MinPoint=MinMove*PriceScale;
If(MarketPosition==0)
{
If(FirstEntryCon)
{
firstPrice=Open;
LastPrice=firstPrice;
Buy(2,firstPrice);
}
}else If(MarketPosition==1)//有多仓的情况
{
While(CurrentEntries<4&&High>=LastPrice+AddSet*MinPoint)//加仓
{
LastPrice=LastPrice+AddSet*MinPoint;
if(Open>LastPrice)LastPrice=Open;
Buy(1,LastPrice);
}
While(CurrentEntries>0&&Low<=firstPrice-SubSet*MinPoint)//减仓
{
firstPrice=firstPrice-SubSet*MinPoint;
if(Open<firstPrice)firstPrice=Open;
Sell(1,firstPrice);
}
}
...
End
|
|