文档视界 最新最全的文档下载
当前位置:文档视界 › 交易开拓者止损止盈

交易开拓者止损止盈

交易开拓者止损止盈
交易开拓者止损止盈

TB源码:

Params

Numeric Length1(10); // 短均线周期

Numeric Length2(20); // 长均线周期

Numeric InitialStop(20); // 初始止损比例*1000

Numeric BreakEvenStop(30); // 保本止损比例*1000

Numeric TrailingStop(50); // 追踪止损比例*1000

Numeric Lots(1); // 头寸大小

Vars

NumericSeries MA1;

NumericSeries MA2;

BoolSeries condBuy(false); // 做多条件

BoolSeries condSell(false); // 做空条件

Numeric MinPoint;

Numeric MyPrice;

NumericSeries LowerAfterEntry; // 空头盈利峰值价

BoolSeries bShortStoped(false); // 当前均线空头趋势下是否有过一次进场Numeric StopLine(0);

Begin

// 把上一根bar的出场状况传递过来

if (BarStatus > 0)

{

bShortStoped = bShortStoped[1];

}

Commentary("bShortStoped="+IIFString(bShortStoped,"true","false"));

// 传递或比较盈利峰值价

If(BarsSinceEntry >= 1)

{

LowerAfterEntry = Min(LowerAfterEntry[1],Low[1]);

}

Else

{

LowerAfterEntry = LowerAfterEntry[1];

}

Commentary("LowerAfterEntry="+Text(LowerAfterEntry));

// 过滤集合竞价

If((BarType==1 or BarType==2) && date!=date[1] && high==low) return;

If(BarType==0 && CurrentTime<=0.09 && high==low) return;

MinPoint = MinMove * PriceScale;

MA1 = AverageFC(Close,Length1);

MA2 = AverageFC(Close,Length2);

PlotNumeric("MA1",MA1);

PlotNumeric("MA2",MA2);

相关文档