请问一下老师:
系统带的TrailStop 名称: 触发跟踪止盈 和下面的写法功能上有什么不同,核心区别是什么?
If(MarketPosition==1 And BarsSinceEntry>0 And HighestAfterEntry>=EntryPrice*(1+TrailingStart/1000))
{
If(Low <= HighestAfterEntry[1]-EntryPrice*TrailingStop/1000)
{
MyPrice = HighestAfterEntry[1]-EntryPrice*TrailingStop/1000;
If(Open < MyPrice) MyPrice = Open;
Sell(0,myprice);
bOut = True;
}
}
If(MarketPosition==-1 And BarsSinceEntry>0 And LowestAfterEntry<=EntryPrice*(1-TrailingStart/1000))
{
If(High >= LowestAfterEntry[1] + EntryPrice*TrailingStop/1000)
{
MyPrice = LowestAfterEntry[1] + EntryPrice*TrailingStop/1000;
If(Open > MyPrice) MyPrice = Open;
BuyToCover(0,MyPrice);
bOut = True;
}
}
系统自带的那个是作为模式的组件,合成模式的时候使用的。
区别不是很大。
只不过是做了一些泛用性的处理
谢谢