公式简介: 为了更好的让大家体验开拓者TB的自动交易功能,我们特写了上莽牛操盘手策略源码,并免FEI符上,但是能不能盈利?盈利有多少?我们并不做说明,因为这个莽牛操盘手策略仅供大家学习交流之用。要使用经过实盘验证的策略,可与西部汇市联系,我们为你们推荐适合您的那一款,以下是这款策略实盘界面:
莽牛操盘手实图
上图在K线部分可以看到三条红色连线,这就是历史交易指令的持仓连线,意为开仓与平仓间的持仓部分。图中两个向上箭头一黄一紫,分别代表买开和买平,如果是向下则代表卖平和卖开。如果您已开通开拓者TB软件,那么下载这款莽牛操盘手策略并编译后启动自动交易就可以实现程序化交易了... Params
Numeric K1(50);
Numeric K2(7);
Numeric nOffSet(0);
Numeric stopLossSet(100);
Vars
NumericSeries a1;
NumericSeries a2;
Numeric MinPoint;
Numeric MyEntryPrice;
Numeric MyExitPrice;
Numeric stopLossPoint;
Numeric offSetDots;
bool cross1;
bool cross2;
Begin
offSetDots = nOffSet * MinMove * PriceScale;
a1=Highest(high[1],K1);
a2=Lowest(low[1],K2);
cross1=CrossOver(high,a1);
cross2=CrossUnder(low,a2);
If(cross1 && MarketPosition<>1)
{
Buy(1,a1+offSetDots);
}
If(cross2 && MarketPosition<>-1)
{
SellShort(1,a2-offSetDots);
}
stopLossPoint = stopLossSet * MinMove * PriceScale;
If(MarketPosition == 1)
{
myEntryPrice = AvgEntryPrice;
If(low <= myEntryPrice - stopLossPoint)
{
myExitPrice = myEntryPrice - stopLossPoint;
If(open < myExitPrice) myExitPrice = open;
Sell(0,myExitPrice);
}
}
else If (MarketPosition == -1)
{
myEntryPrice = AvgEntryPrice;
If(High >= myEntryPrice + stopLossPoint)
{
myExitPrice = myEntryPrice + stopLossPoint;
If(open > myExitPrice) myExitPrice = open;
BuyToCover(0,myExitPrice);
}
}
End
|
