请大侠帮修改一个信号闪烁问题 [开拓者 TB]
- 咨询内容:
问题描述:做if1508 1分钟k线 程序出现平仓信号后实盘马上平仓,但信号很可能会在该k线这一分钟内闪烁而消失 则应继续持仓,而实盘已平仓。希望平仓改为“平仓信号在该k线走完后的收盘价信号仍然还在时,平仓交易” 如何改:
//平仓继续
If(MarketPosition == 1)
{
If (High >= EntryPrice + ProfitTarget)
{
Sell(0, Max(Open, EntryPrice + ProfitTarget));
Commentary("多头止盈");
}
Else If (Highest(High, BarsSinceEntry) >= EntryPrice + MinPBCritical && Close < EntryPrice + MinProfitTarget)
{
Sell(0, Close);
Commentary("多头最低止盈");
}
Else If (ExitLong)
{
Sell(0, Close);
Commentary("多头日内平仓");
}
If(OpenPeriod == 1)
{
If (Highest(High, BarsSinceEntry) >= EntryPrice + PBCritical && Close <= Highest(High, BarsSinceEntry) - Drawdown)
{
Sell(0, Close);
Commentary("多头回撤止盈");
}
}
If(Highest(BIAS, BarsSinceEntry) >= 20 && BIAS < 9.5)
{
Sell(0, Close);
Commentary("BIAS平多");
IsFirBShort = False;
}
}
If(MarketPosition==-1)
{
If (Low <= EntryPrice - ProfitTarget)
{
BuyToCover(0, Min(Open, EntryPrice - ProfitTarget));
Commentary("空头止盈");
}
Else If (Lowest(Low, BarsSinceEntry) <= EntryPrice - MinPBCritical && Close > EntryPrice - MinProfitTarget)
{
BuyToCover(0, Close);
Commentary("空头最低止盈");
}
Else If (ExitShort)
{
BuyToCover(0, Close);
Commentary("空头日内平仓");
}
If(OpenPeriod == 1)
{
If (Lowest(Low, BarsSinceEntry) <= EntryPrice - PBCritical && Close >= Lowest(Low, BarsSinceEntry) + Drawdown)
{
BuyToCover(0, Close);
Commentary("空头回撤止盈");
}
}
If(Lowest(BIAS, BarsSinceEntry) <= -20 && BIAS > -9.5)
{
BuyToCover(0, Close);
Commentary("BIAS平空");
IsFirSShort = False;
}
}
If (GetGlobalVar(0) != 888)
SetGlobalVar(1, 0);//延迟TICK数量
Else
SetGlobalVar(1, GetGlobalVar(1) + 1);
- TB技术人员:
Else If (Highest(High, BarsSinceEntry) >= EntryPrice + MinPBCritical && Close[1] < EntryPrice + MinProfitTarget)
{
Sell(0, open);
Commentary("多头最低止盈");
}
下面程序也都这样修改 - TB客服: 把close 改成 close[1]之后,模型立刻变得没有太多盈利
有思路,想编写各种指标公式,程序化交易模型,选股公式,预警公式的朋友
可联系技术人员 QQ: 511411198 进行 有偿 编写!(不贵!点击查看价格!)
相关文章
-
没有相关内容