- 精华
- 0
- 在线时间
- 20 小时
- UID
- 186184
- 积分
- 22
- 帖子
- 13
- 阅读权限
- 10
- 注册时间
- 2014-5-6
- 最后登录
- 2016-4-3
- 精华
- 0
- UID
- 186184
- 积分
- 22
- 帖子
- 13
- 主题
- 9
- 阅读权限
- 10
- 注册时间
- 2014-5-6
- 最后登录
- 2016-4-3
|
本帖最后由 zlqh19000795 于 2015-8-12 14:26 编辑
问题描述:做if1508 1分钟k线 程序出现平仓信号后实盘马上平仓,但信号很可能会在该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);
|
|