V4中追踪止盈代码怎么写? - TradeBlazer公式
作者:开拓者 TB 来源:cxh99.com 发布时间:2012年09月15日
- 咨询内容:
- Params
- Numeric lots(1);
- Vars
- NumericSeries ma5;
- NumericSeries ma20;
- NumericSeries stopprofit;
- NumericSeries EntryPrice;
- NumericSeries ExitPrice;
- NumericSeries PriceAfterEntry;
- Begin
- ma5=Average(close,5);
- ma20=Average(close,20);
- PlotNumeric("ma5",ma5);
- PlotNumeric("ma20",ma20);
- If(CrossOver(ma5[1],ma20[1]))//Ma5上穿Ma20
- Buy(lots,open);
- Entryprice=open;
- If(marketposition==1&&PositionProfit>5)//盈利大于五点时追踪止盈
- {stopprofit=EntryPrice+2;//止盈点在进场点上方2点
- ExitPrice=Max(open,stopprofit);
- }
- Sell(lots,ExitPrice);
- End
- TB技术人员: 请参考 帮助文档 - 公式应用进阶
- TB客服: 如果用A指令下单又怎么写呢?