请帮我看下为什么总是出现交易讯号消失 [开拓者 TB]
- 咨询内容:
请帮我看下为什么总是出现交易讯号消失,导致您的持仓不匹配呢
Params
Numeric Lots(1);
Numeric ExitOnCloseMins(14.59);
Numeric maLen1(10);
Numeric maLen2(30);
Vars
Numeric ma1;
Numeric ma2;
Numeric TakeProfit(1);
Numeric TakeProfit2(2);
Numeric MinPoint;
Numeric MyEntryPrice;
Numeric MyExitPrice;
NumericSeries HighestAfterEntry; // 开仓后出现的最高价
NumericSeries LowestAfterEntry; // 开仓后出现的最低价
Numeric StopLine(0);
Begin
ma1 = Average(Open,maLen1);
ma2 = Average(Open,maLen2);
MyEntryPrice = AvgEntryPrice;
HighestAfterEntry = Close[1];
LowestAfterEntry = Close[1];
Commentary("ma1: "+Text(ma1));
Commentary("ma2: "+Text(ma2));
If(CurrentBar > maLen2)
{
If(MarketPosition==0)
{
if((Open>=ma1)&&(ma1>ma2))
{
MyEntryPrice==open;
Buy(lots,MyEntryPrice);
HighestAfterEntry = Max(HighestAfterEntry,AvgEntryPrice);
LowestAfterEntry = Min(LowestAfterEntry,AvgEntryPrice);
Return;
}
if((Open<ma1)&&(ma1<ma2))
{
MyEntryPrice==open;
SellShort(lots,MyEntryPrice);
HighestAfterEntry = Max(HighestAfterEntry,AvgEntryPrice);
LowestAfterEntry = Min(LowestAfterEntry,AvgEntryPrice);
Return;
}
HighestAfterEntry = Max(HighestAfterEntry,High);
LowestAfterEntry = Min(LowestAfterEntry,Low);
}
If(MarketPosition==1)//多仓
{
If(High>=ma1&&(High>HighestAfterEntry[1]))//增仓
{ MyEntryPrice=Open;
Buy(Lots,Open);
HighestAfterEntry=High;
Commentary("增仓: "+Text(Open));
}
If(High>=ma1&&(High<HighestAfterEntry[1]))//未突破前期高位反手
{
MyEntryPrice=Open;
SellShort(1,MyEntryPrice);
}
If(Low<ma1&&(Low<LowestAfterEntry[1]))//止损并反手
{
MyExitPrice=Open;
Sell(0,Open);
MyEntryPrice=MyExitPrice;
SellShort(1,Open);
LowestAfterEntry=Low;
}
If(Low<ma1&&(Low>LowestAfterEntry[1]))//未突破前期低位增仓
{
MyEntryPrice=Open;
Buy(1,MyEntryPrice);
}
}else If(MarketPosition==-1)//空仓
{
If(Low<ma1&&(Low<LowestAfterEntry[1]))//增仓
{
MyEntryPrice=Open;
SellShort(1,Open);
LowestAfterEntry=Low;
}
If(Low<=ma1&&(Low>LowestAfterEntry[1]))//未突破前期高位反手
{
MyEntryPrice=Open;
Buy(1,MyEntryPrice);
}
If(High>=ma1&&(High>HighestAfterEntry[1]))//止损并反手
{
MyExitPrice=Open;
BuyToCover(0,Open);
MyEntryPrice=MyExitPrice;
Buy(1,Open);
HighestAfterEntry=High;
}
If(High>=ma1&&(High<HighestAfterEntry[1]))//未突破前期低位增仓
{
MyEntryPrice=Open;
SellShort(1,MyEntryPrice);
}
}
}
- TB技术人员: 大哥,是你吗?把这个不能用的换了我那个能用的
有思路,想编写各种指标公式,程序化交易模型,选股公式,预警公式的朋友
可联系技术人员 QQ: 511411198 进行 有偿 编写!(不贵!点击查看价格!)
相关文章
-
没有相关内容